From: Andre Noll Date: Fri, 27 Aug 2021 13:52:43 +0000 (+0200) Subject: alsa_write: Avoid spurious underrun warnings. X-Git-Tag: v0.7.0~22^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=295bf77b48df9a409501f5cabce7bd0a96ce48dc;ds=sidebyside alsa_write: Avoid spurious underrun warnings. Receiving EPIPE does not necessarily mean that an underrun occurred. We also have to check the pcm state. --- diff --git a/alsa_write.c b/alsa_write.c index 2d834022..bbbf8b65 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -331,7 +331,11 @@ again: goto again; } if (frames == -EPIPE) { - PARA_WARNING_LOG("underrun (tried to write %zu bytes)\n", bytes); + snd_pcm_status_t *status; + snd_pcm_status_malloc(&status); + if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) + PARA_WARNING_LOG("underrun\n"); + snd_pcm_status_free(status); snd_pcm_prepare(pad->handle); return 0; }