From: Sangchul Lee Date: Thu, 19 Nov 2020 06:37:20 +0000 (+0900) Subject: stream-manager: Invoke ramp finish hook when ducking stream is corked X-Git-Tag: submit/tizen/20201120.012041^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e65d41959c8558998c0093d892bddc6b2dfd65f3;p=platform%2Fcore%2Fmultimedia%2Fpulseaudio-modules-tizen.git stream-manager: Invoke ramp finish hook when ducking stream is corked If a user corks a stream that ducking is in progress, it can not get a ramp finish callback from the pulseaudio core. It leads to invalid state of the stream ducking handle, therefore it is fixed to trigger the callback forcedly when this situation happens. [Version] 13.0.39 [Issue Type] Bug fix Change-Id: Icbe7d4ce2d70fcbfbba9afb2555a38308df18349 Signed-off-by: Sangchul Lee --- diff --git a/packaging/pulseaudio-modules-tizen.spec b/packaging/pulseaudio-modules-tizen.spec index 6178a05..ea1c478 100644 --- a/packaging/pulseaudio-modules-tizen.spec +++ b/packaging/pulseaudio-modules-tizen.spec @@ -1,6 +1,6 @@ Name: pulseaudio-modules-tizen Summary: Pulseaudio modules for Tizen -Version: 13.0.38 +Version: 13.0.39 Release: 0 Group: Multimedia/Audio License: LGPL-2.1+ diff --git a/src/stream-manager.c b/src/stream-manager.c index 4507a71..4c12613 100644 --- a/src/stream-manager.c +++ b/src/stream-manager.c @@ -2416,8 +2416,8 @@ static void remove_sink_input_from_muted_streams(pa_stream_manager *m, pa_sink_i pa_idxset_remove_by_data(streams, i, NULL); } -/* Remove the sink-input from ducking streams */ -static void remove_sink_input_from_ducking_streams(pa_stream_manager *m, pa_sink_input *i) { +/* It can be utilized when it requires to invoke the ramp finish hook forcedly */ +static stream_ducking* fire_ramp_finish_hook_when_ducking_or_unducking_state(pa_stream_manager *m, pa_sink_input *i) { uint32_t idx = 0; stream_ducking *sd = NULL; void *stream = NULL; @@ -2429,17 +2429,29 @@ static void remove_sink_input_from_ducking_streams(pa_stream_manager *m, pa_sink PA_IDXSET_FOREACH(stream, sd->idx_ducking_streams, idx) { if (stream != i) continue; - if (sd->state == STREAM_DUCKING_STATE_DUCKING || - sd->state == STREAM_DUCKING_STATE_UNDUCKING) + sd->state == STREAM_DUCKING_STATE_UNDUCKING) { + pa_log_debug("stream(%p, index:%u) ducking state[%s]", + i, i->index, sd->state == STREAM_DUCKING_STATE_DUCKING ? "DUCKING" : "UNDUCKING"); pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_RAMP_FINISH], i); + } + return sd; + } + } - pa_log_error("remove stream(idx:%u,%p) from idx_ducking_streams, trigger_index(%u)", - i->index, i, sd->trigger_index); - pa_idxset_remove_by_data(sd->idx_ducking_streams, i, NULL); + return NULL; +} - return; - } +/* Remove the sink-input from ducking streams */ +static void remove_sink_input_from_ducking_streams(pa_stream_manager *m, pa_sink_input *i) { + stream_ducking *sd; + + pa_assert(m); + + if ((sd = fire_ramp_finish_hook_when_ducking_or_unducking_state(m, i))) { + pa_log_error("remove stream(%p, index:%u) from idx_ducking_streams, trigger_index(%u)", + i, i->index, sd->trigger_index); + pa_idxset_remove_by_data(sd->idx_ducking_streams, i, NULL); } } @@ -2537,6 +2549,7 @@ static pa_hook_result_t sink_input_state_changed_cb(pa_core *core, pa_sink_input switch (i->state) { case PA_SINK_INPUT_CORKED: process_stream(m, i, STREAM_SINK_INPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STATE_CHANGED_CORKED, false); + fire_ramp_finish_hook_when_ducking_or_unducking_state(m, i); break; case PA_SINK_INPUT_RUNNING: process_stream(m, i, STREAM_SINK_INPUT, PROCESS_COMMAND_CHANGE_ROUTE_BY_STATE_CHANGED_RUNNING, false);