diff options
author | wm4 <wm4@nowhere> | 2013-11-17 16:10:28 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-17 16:22:32 +0100 |
commit | 8438c557cff37bd5861a9fd8e94941aba7e22aaf (patch) | |
tree | 5f3577a3863fc7d4af8a417c37c1d108dc8cde8d /mpvcore/player/loadfile.c | |
parent | e403140201d5216b87cf917d0c027dba42867dcb (diff) | |
download | mpv-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/player/loadfile.c')
-rw-r--r-- | mpvcore/player/loadfile.c | 10 |
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); } |