player: fix inconsistent AO pause state in certain situations

Pause can be changed during a file change, such as with for example
--reset-on-next-file=pause, or in hooks, or by being quick, and in this
case the AO's pause state was not updated correctly. mpctx->ao_chain is
only set if playback is fully initialized, while the AO itself in
mpctx->ao can be reused across files.

Fix this by always running set_pause_state() if the pause option is
changed. Could cause new bugs since running this used to be explicitly
avoided outside of the loaded state. The handling of time_frame is
potentially worrisome.

Regression due to recent audio refactor; before that, the AO didn't have
a separate/persistent pause state.

Fixes: #8079
This commit is contained in:
wm4 2020-09-12 00:09:20 +02:00
parent 98f9d50b30
commit eed8b6d47b
2 changed files with 3 additions and 8 deletions

View File

@ -6493,13 +6493,8 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags,
} }
} }
if (opt_ptr == &opts->pause) { if (opt_ptr == &opts->pause)
if (mpctx->playback_initialized) { set_pause_state(mpctx, opts->pause);
int val = opts->pause;
opts->pause = !val; // temporary hack to force update
set_pause_state(mpctx, val);
}
}
if (opt_ptr == &opts->audio_delay) { if (opt_ptr == &opts->audio_delay) {
if (mpctx->ao_chain) { if (mpctx->ao_chain) {

View File

@ -159,7 +159,7 @@ void set_pause_state(struct MPContext *mpctx, bool user_pause)
if (internal_paused != mpctx->paused) { if (internal_paused != mpctx->paused) {
mpctx->paused = internal_paused; mpctx->paused = internal_paused;
if (mpctx->ao && mpctx->ao_chain) if (mpctx->ao)
ao_set_paused(mpctx->ao, internal_paused); ao_set_paused(mpctx->ao, internal_paused);
if (mpctx->video_out) if (mpctx->video_out)