mirror of
https://github.com/mpv-player/mpv
synced 2025-01-31 04:02:06 +00:00
ao_alsa: remove unneeded checks
If initialization succeeds, p->alsa should always be set. Additional checks are not needed, and also this wasn't even done consistently.
This commit is contained in:
parent
557efff690
commit
17d72de2ac
@ -646,11 +646,6 @@ static int play(struct ao *ao, void **data, int samples, int flags)
|
|||||||
if (!(flags & AOPLAY_FINAL_CHUNK))
|
if (!(flags & AOPLAY_FINAL_CHUNK))
|
||||||
samples = samples / p->outburst * p->outburst;
|
samples = samples / p->outburst * p->outburst;
|
||||||
|
|
||||||
if (!p->alsa) {
|
|
||||||
MP_ERR(ao, "Device configuration error.");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (samples == 0)
|
if (samples == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -709,7 +704,6 @@ alsa_error:
|
|||||||
static float get_delay(struct ao *ao)
|
static float get_delay(struct ao *ao)
|
||||||
{
|
{
|
||||||
struct priv *p = ao->priv;
|
struct priv *p = ao->priv;
|
||||||
if (p->alsa) {
|
|
||||||
snd_pcm_sframes_t delay;
|
snd_pcm_sframes_t delay;
|
||||||
|
|
||||||
if (snd_pcm_state(p->alsa) == SND_PCM_STATE_PAUSED)
|
if (snd_pcm_state(p->alsa) == SND_PCM_STATE_PAUSED)
|
||||||
@ -724,8 +718,6 @@ static float get_delay(struct ao *ao)
|
|||||||
delay = 0;
|
delay = 0;
|
||||||
}
|
}
|
||||||
return (float)delay / (float)ao->samplerate;
|
return (float)delay / (float)ao->samplerate;
|
||||||
} else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define OPT_BASE_STRUCT struct priv
|
#define OPT_BASE_STRUCT struct priv
|
||||||
|
Loading…
Reference in New Issue
Block a user