summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-10-05 16:06:37 +0200
committerwm4 <wm4@nowhere>2016-10-05 16:06:37 +0200
commit3825dc63b2d29f3dc7dbd8f9e5e8db4293d3421b (patch)
tree3132b1f06131d12ec19c92a796073854a9e7ed1b /player/command.c
parente6291697e3b7d540dcee3cd49100d69d656f696a (diff)
downloadmpv-3825dc63b2d29f3dc7dbd8f9e5e8db4293d3421b.tar.bz2
mpv-3825dc63b2d29f3dc7dbd8f9e5e8db4293d3421b.tar.xz
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".
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c4
1 files changed, 3 insertions, 1 deletions
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);
}