From 3825dc63b2d29f3dc7dbd8f9e5e8db4293d3421b Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 5 Oct 2016 16:06:37 +0200 Subject: command: flush and uninitialize audio output first on option changes This affects changing audio configuration options. Explicitly flush and uninitialize the audio output first before doing the rest. This should ensure all state attached to the audio output is discarded and not used during the reconfiguration. Also add a comment to the reinit_audio_filters() call. It doesn't necessarily restore the audio chain fully, but makes sure a seek is issued if the amnount of buffered audio discarded was huge enough to cause "problems". --- player/command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/command.c b/player/command.c index 468a1cc901..e11f485056 100644 --- a/player/command.c +++ b/player/command.c @@ -5737,8 +5737,10 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags) if ((flags & UPDATE_AUDIO) && mpctx->ao_chain) { // Force full mid-stream reinit. - reinit_audio_filters(mpctx); + if (mpctx->ao) + ao_reset(mpctx->ao); uninit_audio_out(mpctx); + reinit_audio_filters(mpctx); // mostly to issue refresh seek mp_wakeup_core(mpctx); } -- cgit v1.2.3