diff options
author | wm4 <wm4@nowhere> | 2019-10-06 20:28:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-10-06 20:46:22 +0200 |
commit | e5a97ef27f8be577debb0cbd8acbcc8f743cc4d1 (patch) | |
tree | 94098624f6eee49c5a8142aeda13fb6488faf418 /player/audio.c | |
parent | e38b0b245ed4b12f71f0274e25275f301faf93a3 (diff) | |
download | mpv-e5a97ef27f8be577debb0cbd8acbcc8f743cc4d1.tar.bz2 mpv-e5a97ef27f8be577debb0cbd8acbcc8f743cc4d1.tar.xz |
audio: do not try gapless if video is still ongoing
In this case, gapless will most likely not work. It will result in (very
slight) desync, or (more commonly with small buffer sizes), in an
underflow.
I think it would be legitimate to disable gapless at end of playback
completely if video is enabled at all. But this would need an exception
for cover art mode, so I guess the current solution is OK as well.
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/player/audio.c b/player/audio.c index 308b27aec1..161e3d7c69 100644 --- a/player/audio.c +++ b/player/audio.c @@ -980,7 +980,11 @@ void fill_audio_out_buffers(struct MPContext *mpctx) // With gapless audio, delay this to ao_uninit. There must be only // 1 final chunk, and that is handled when calling ao_uninit(). - if (audio_eof && !opts->gapless_audio) + // If video is still on-going, trying to do gapless is pointless, as video + // will have to continue for a while with audio stopped (but still try to + // do it if gapless is forced, mostly for testing). + if (audio_eof && (!opts->gapless_audio || + (opts->gapless_audio <= 0 && mpctx->video_status != STATUS_EOF))) playflags |= AOPLAY_FINAL_CHUNK; uint8_t **planes; |