From 295bf77b48df9a409501f5cabce7bd0a96ce48dc Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 27 Aug 2021 15:52:43 +0200 Subject: [PATCH] alsa_write: Avoid spurious underrun warnings. Receiving EPIPE does not necessarily mean that an underrun occurred. We also have to check the pcm state. --- alsa_write.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.39.5