summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-17 16:10:28 +0100
committerwm4 <wm4@nowhere>2013-11-17 16:22:32 +0100
commit8438c557cff37bd5861a9fd8e94941aba7e22aaf (patch)
tree5f3577a3863fc7d4af8a417c37c1d108dc8cde8d /mpvcore
parente403140201d5216b87cf917d0c027dba42867dcb (diff)
downloadmpv-8438c557cff37bd5861a9fd8e94941aba7e22aaf.tar.bz2
mpv-8438c557cff37bd5861a9fd8e94941aba7e22aaf.tar.xz
player: write final audo chunk only if there is audio left
Don't call ao_play() if there's nothing left. Of course this still asks the AO to play internally buffered audio by setting drain=true.
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/player/loadfile.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mpvcore/player/loadfile.c b/mpvcore/player/loadfile.c
index 0c40f34900..f787b5e495 100644
--- a/mpvcore/player/loadfile.c
+++ b/mpvcore/player/loadfile.c
@@ -169,10 +169,12 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
mp_audio_buffer_peek(ao->buffer, &data);
int samples = ao->buffer_playable_samples;
assert(samples <= data.samples);
- int played = ao_play(ao, data.planes, samples,
- AOPLAY_FINAL_CHUNK);
- if (played < samples)
- MP_WARN(ao, "Audio output truncated at end.\n");
+ if (samples > 0) {
+ int played = ao_play(ao, data.planes, samples,
+ AOPLAY_FINAL_CHUNK);
+ if (played < samples)
+ MP_WARN(ao, "Audio output truncated at end.\n");
+ }
}
ao_uninit(ao, drain);
}