From 81e51a15f7e16d23216c7ab78502df245157723e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 6 Oct 2019 20:09:07 +0200 Subject: ao_alsa: remove sometimes bogus XRUN message This XRUN (aka underrun) message was printed in the following situations: 1) legitimate underrun during playback 2) legitimate underrun when playing final chunk 3) bogus underrun when playing final chunk The old underrun case (in play()) happens in cases 1) and 2) as well, but 3) did not happen. It appears 3) is indeed something that happens, although it's not known for sure. It's still pretty annoying, so remove the new XRUN message. When testing, care should be taken to play with buffer sizes, video versus no video, and gapless enabled/disabled. Also, suspending the player with Ctrl+Z in the terminal (SIGSTOP) and then resuming is a good way to trigger a "normal" underrun. --- audio/out/ao_alsa.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index df78a67178..28294ccc13 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -946,14 +946,7 @@ static int get_space(struct ao *ao) return p->buffersize; snd_pcm_sframes_t space = snd_pcm_avail(p->alsa); - if (space < 0) { - if (space == -EPIPE) { - MP_WARN(ao, "ALSA XRUN hit, attempting to recover...\n"); - int err = snd_pcm_prepare(p->alsa); - CHECK_ALSA_ERROR("Unable to recover from under/overrun!"); - return p->buffersize; - } - + if (space < 0 && space != -EPIPE) { MP_ERR(ao, "Error received from snd_pcm_avail " "(%ld, %s with ALSA state %s)!\n", space, snd_strerror(space), @@ -965,7 +958,7 @@ static int get_space(struct ao *ao) goto alsa_error; } - if (space > p->buffersize) // Buffer underrun? + if (space > p->buffersize || space < 0) // Buffer underrun? space = p->buffersize; return space / p->outburst * p->outburst; -- cgit v1.2.3