summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2018-09-20 20:11:45 +0300
committersfan5 <sfan5@live.de>2018-09-29 20:02:46 +0200
commit3218a5808229b06bd7e2d41a912e7e7031525d56 (patch)
tree13488eed436c9d958df5bdbf70a58b2d6db40e56 /audio
parent9c184078a66a7de0e94d72a4bb038dde6a4ab455 (diff)
downloadmpv-3218a5808229b06bd7e2d41a912e7e7031525d56.tar.bz2
mpv-3218a5808229b06bd7e2d41a912e7e7031525d56.tar.xz
ao_alsa: early exit get_space if paused or ALSA is not ready
This has been way too long coming, and for me to notice that a whole lot of ao_alsa functions do an early return if the AO is paused. For the STATE_SETUP case, I had this reproduced once, and never since. Still, seems like we can start calling this function before the ALSA device has been fully initialized so we might as well early exit in that case.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_alsa.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index 32f08bef59..6b93b854c0 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -940,6 +940,11 @@ static int get_space(struct ao *ao)
{
struct priv *p = ao->priv;
+ // in case of pausing or the device still being configured,
+ // just return our buffer size.
+ if (p->paused || snd_pcm_state(p->alsa) == SND_PCM_STATE_SETUP)
+ return p->buffersize;
+
snd_pcm_sframes_t space = snd_pcm_avail(p->alsa);
if (space < 0) {
MP_ERR(ao, "Error received from snd_pcm_avail (%ld, %s)!\n",