From e65361ba1748adfe0621fbab0207b348b4ed8578 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Thu, 17 Mar 2016 12:54:17 +0100 Subject: [PATCH] [alsa] Don't query snd_pcm_delay() during an underrun --- src/laudio_alsa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/laudio_alsa.c b/src/laudio_alsa.c index 83b82f26..436d8e6b 100644 --- a/src/laudio_alsa.c +++ b/src/laudio_alsa.c @@ -89,8 +89,6 @@ laudio_alsa_xrun_recover(int err) { DPRINTF(E_WARN, L_LAUDIO, "PCM buffer underrun\n"); - pcm_last_error = 0; - ret = snd_pcm_prepare(hdl); if (ret < 0) { @@ -263,6 +261,7 @@ laudio_alsa_write(uint8_t *buf, uint64_t rtptime) return; } + pcm_last_error = 0; pcm_pos += nsamp; pkt->offset += STOB(nsamp); @@ -293,6 +292,9 @@ laudio_alsa_get_pos(void) if (pcm_pos == 0) return 0; + if (pcm_last_error != 0) + return pcm_pos; + ret = snd_pcm_delay(hdl, &delay); if (ret < 0) {