summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-30 18:56:44 +0100
committerwm4 <wm4@nowhere>2013-11-30 18:56:44 +0100
commit17d72de2ac16ba78d05b2210112fa2c4335cf1f9 (patch)
tree65fcf6873a272100d50af7d04c23202785b97194 /audio
parent557efff690c7c047466d3f9b613b1d5416ef1f70 (diff)
downloadmpv-17d72de2ac16ba78d05b2210112fa2c4335cf1f9.tar.bz2
mpv-17d72de2ac16ba78d05b2210112fa2c4335cf1f9.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_alsa.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 2c6df71cd0..b8de922cb9 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -646,11 +646,6 @@ static int play(struct ao *ao, void **data, int samples, int flags)
if (!(flags & AOPLAY_FINAL_CHUNK))
samples = samples / p->outburst * p->outburst;
- if (!p->alsa) {
- MP_ERR(ao, "Device configuration error.");
- return -1;
- }
-
if (samples == 0)
return 0;
@@ -709,23 +704,20 @@ alsa_error:
static float get_delay(struct ao *ao)
{
struct priv *p = ao->priv;
- if (p->alsa) {
- snd_pcm_sframes_t delay;
-
- if (snd_pcm_state(p->alsa) == SND_PCM_STATE_PAUSED)
- return p->delay_before_pause;
+ snd_pcm_sframes_t delay;
- if (snd_pcm_delay(p->alsa, &delay) < 0)
- return 0;
+ if (snd_pcm_state(p->alsa) == SND_PCM_STATE_PAUSED)
+ return p->delay_before_pause;
- if (delay < 0) {
- /* underrun - move the application pointer forward to catch up */
- snd_pcm_forward(p->alsa, -delay);
- delay = 0;
- }
- return (float)delay / (float)ao->samplerate;
- } else
+ if (snd_pcm_delay(p->alsa, &delay) < 0)
return 0;
+
+ if (delay < 0) {
+ /* underrun - move the application pointer forward to catch up */
+ snd_pcm_forward(p->alsa, -delay);
+ delay = 0;
+ }
+ return (float)delay / (float)ao->samplerate;
}
#define OPT_BASE_STRUCT struct priv