summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/out/ao_alsa.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index d8a1ec5cae..1a2c6f5095 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -939,17 +939,16 @@ static void drain(struct ao *ao)
static int get_space(struct ao *ao)
{
struct priv *p = ao->priv;
- snd_pcm_status_t *status;
int err;
- snd_pcm_status_alloca(&status);
+ unsigned space = err = snd_pcm_avail(p->alsa);
+ if (err == -EPIPE) // EOF
+ return p->buffersize;
- err = snd_pcm_status(p->alsa, status);
if (!check_device_present(ao, err))
goto alsa_error;
- CHECK_ALSA_ERROR("cannot get pcm status");
+ CHECK_ALSA_ERROR("cannot get pcm avail");
- unsigned space = snd_pcm_status_get_avail(status);
if (space > p->buffersize) // Buffer underrun?
space = p->buffersize;
return space / p->outburst * p->outburst;