summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-06 20:09:07 +0200
committerwm4 <wm4@nowhere>2019-10-06 20:46:22 +0200
commit81e51a15f7e16d23216c7ab78502df245157723e (patch)
tree1e3118d2ce2bf2da9146278b5c6f094efdb55694 /audio
parent6d0f0546ee851f4106438c5b92c8d1d152937ea7 (diff)
downloadmpv-81e51a15f7e16d23216c7ab78502df245157723e.tar.bz2
mpv-81e51a15f7e16d23216c7ab78502df245157723e.tar.xz
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.
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_alsa.c11
1 files 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;