diff options
author | wm4 <wm4@nowhere> | 2018-04-12 17:30:31 +0200 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2018-04-15 23:11:33 +0300 |
commit | 9ee9313465ca49f2cfdd407797febed7692e1144 (patch) | |
tree | 5d88eb16f4a3ce131164a3f99b4c7e470e60e9ac /audio/out | |
parent | bd62d7885488d14bf291bf33c6a817b1024c38f7 (diff) | |
download | mpv-9ee9313465ca49f2cfdd407797febed7692e1144.tar.bz2 mpv-9ee9313465ca49f2cfdd407797febed7692e1144.tar.xz |
ao_alsa: actually report underruns to user
Print them as a warning.
Note that there may be some cases where it underruns, without being a
bad condition. This could possibly happen e.g. if the last chunk is
written, and then it resumes playback some time after that. Eventually I
want to add more code to avoid such spurious warnings.
Diffstat (limited to 'audio/out')
-rw-r--r-- | audio/out/ao_alsa.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index 3562634848..d8a1ec5cae 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -856,11 +856,6 @@ static int init_device(struct ao *ao, int mode) (p->alsa, alsa_swparams, p->outburst); CHECK_ALSA_ERROR("Unable to set start threshold"); - /* disable underrun reporting */ - err = snd_pcm_sw_params_set_stop_threshold - (p->alsa, alsa_swparams, boundary); - CHECK_ALSA_ERROR("Unable to set stop threshold"); - /* play silence when there is an underrun */ err = snd_pcm_sw_params_set_silence_size (p->alsa, alsa_swparams, boundary); @@ -1117,6 +1112,11 @@ static int play(struct ao *ao, void **data, int samples, int flags) } else if (res < 0) { if (res == -ESTRPIPE) { /* suspend */ resume_device(ao); + } else if (res == -EPIPE) { + // For some reason, writing a smaller fragment at the end + // immediately underruns. + if (!(flags & AOPLAY_FINAL_CHUNK)) + MP_WARN(ao, "Device underrun detected.\n"); } else { MP_ERR(ao, "Write error: %s\n", snd_strerror(res)); } |