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.
This commit is contained in:
wm4 2019-10-06 20:09:07 +02:00
parent 6d0f0546ee
commit 81e51a15f7
1 changed files with 2 additions and 9 deletions

View File

@ -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;