]> git.tue.mpg.de Git - paraslash.git/commitdiff
alsa_write: Avoid spurious underrun warnings.
authorAndre Noll <maan@tuebingen.mpg.de>
Fri, 27 Aug 2021 13:52:43 +0000 (15:52 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Thu, 21 Oct 2021 17:53:06 +0000 (19:53 +0200)
Receiving EPIPE does not necessarily mean that an underrun occurred. We
also have to check the pcm state.

alsa_write.c

index 2d834022427d309289eee12b14a6c07450a1125f..bbbf8b650ac86c4952ac46f22c166583018bfb88 100644 (file)
@@ -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;
        }