From b021d038c2217903e511ca3673d5f2f1b996c4d4 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 9 Nov 2014 09:58:44 +0100 Subject: audio/out: make ao_request_reload() idempotent This is what you would expect. Before this commit, each ao_request_reload() call would just queue a reload command, and then recreate the AO for the number of times the function was called. Instead of sending a command, introduce some sort of event retrieval mechanism. At least for the reload case, use atomics, because we're too lazy to setup an extra mutex. --- player/command.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 7df0c8a6c3..1968e6d5e5 100644 --- a/player/command.c +++ b/player/command.c @@ -1462,12 +1462,7 @@ static void reload_audio_output(struct MPContext *mpctx) { if (!mpctx->ao) return; - ao_reset(mpctx->ao); - uninit_audio_out(mpctx); - // This normally recreates the AO, although there are situations when AO - // creation is delayed; for example if there are no audio packets around, - // and the audio format is yet unknown. - reinit_audio_chain(mpctx); + ao_request_reload(mpctx->ao); } static int mp_property_audio_device(void *ctx, struct m_property *prop, -- cgit v1.2.3