diff options
author | Dudemanguy <random342@airmail.cc> | 2023-08-09 22:50:05 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-08-11 22:28:50 +0000 |
commit | 41c03212083485afd683c4b6231d49b9557bb0a4 (patch) | |
tree | 57e9d607f60e8da20631187ee07b7c7fa2beca8f /player/audio.c | |
parent | 908dc791299672042b0fc24de64b57f88bba313c (diff) | |
download | mpv-41c03212083485afd683c4b6231d49b9557bb0a4.tar.bz2 mpv-41c03212083485afd683c4b6231d49b9557bb0a4.tar.xz |
audio: drain ao before setting pause
There's an edge cause with gapless audio and pausing. Since, gapless
audio works by sending an EOF immediately, it's possible to pause on the
next file before audio actually finishes playing and thus the sound gets
cut off. The fix is to simply just always do an ao_drain if the ao is
about to set a pause on EOF and we still have audio playing.
Fixes #8898.
Diffstat (limited to 'player/audio.c')
-rw-r--r-- | player/audio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/player/audio.c b/player/audio.c index fbba8acd11..4ea2d09f94 100644 --- a/player/audio.c +++ b/player/audio.c @@ -486,7 +486,8 @@ static int reinit_audio_filters_and_output(struct MPContext *mpctx) ao_c->ao_resume_time = opts->audio_wait_open > 0 ? mp_time_sec() + opts->audio_wait_open : 0; - ao_set_paused(mpctx->ao, get_internal_paused(mpctx)); + bool eof = mpctx->audio_status == STATUS_EOF; + ao_set_paused(mpctx->ao, get_internal_paused(mpctx), eof); ao_chain_set_ao(ao_c, mpctx->ao); |