From: Sangchul Lee Date: Tue, 4 Feb 2020 03:39:32 +0000 (+0900) Subject: stream-manager: Improve sending ducking state changed signal X-Git-Tag: submit/tizen/20200205.062641^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24c0b9a25695d4231ab2ddfce6ced18cb283540c;p=platform%2Fcore%2Fmultimedia%2Fpulseaudio-modules-tizen.git stream-manager: Improve sending ducking state changed signal If two or more ducking requests have been activated to the same target stream type during ducking operation, ducking state changed signal should be emitted for each ducking request handle respectively. Previously, it did not work well. It is now fixed. Note that these ducking state changed signals will be emitted at the same time when the sink-input's ramp finish hook is called in the thread context as soon as the final ducking operation has been done. [Version] 11.1.97 [Issue Type] Bug fix Change-Id: I3de608a7053c6c61e74ff67af271d2972f5149a1 Signed-off-by: Sangchul Lee --- diff --git a/packaging/pulseaudio-modules-tizen.spec b/packaging/pulseaudio-modules-tizen.spec index 7d4aa32..eae842b 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: 11.1.96 +Version: 11.1.97 Release: 0 Group: Multimedia/Audio License: LGPL-2.1+ diff --git a/src/stream-manager.c b/src/stream-manager.c index 077a40c..69b981e 100644 --- a/src/stream-manager.c +++ b/src/stream-manager.c @@ -2589,36 +2589,32 @@ static pa_hook_result_t sink_input_ramp_finish_cb(pa_core *core, pa_sink_input * PA_HASHMAP_FOREACH(sd, m->stream_duckings, state) { PA_IDXSET_FOREACH(stream, sd->idx_ducking_streams, idx) { if (stream == i && sd->ducking_stream_count > 0) { - pa_log_info("matched (%p,%p)", sd, i); + pa_log_info("found matched stream(%p, index:%u) in sd(%p)", i, i->index, sd); break; } } + if (stream != i) { + pa_log_debug("not found matched stream(%p, index:%u) in sd(%p)", i, i->index, sd); + continue; + } - if (stream == i) - break; - } - - if (stream != i) { - pa_log_error("not found matched stream for %p", i); - return PA_HOOK_OK; - } - - /* Remove trigger when unducked */ - if (sd->state == STREAM_DUCKING_STATE_UNDUCKING) - pa_idxset_remove_by_data(sd->idx_ducking_streams, (void *)i, NULL); + /* Remove trigger when unducked */ + if (sd->state == STREAM_DUCKING_STATE_UNDUCKING) + pa_idxset_remove_by_data(sd->idx_ducking_streams, (void *)i, NULL); - /* Send signal when all streams are ducked. - * Note that the condition of increasing count value below is located in - * handle_activate_ducking() of DBus handler. */ - if (sd->ducking_stream_count > 0 && --sd->ducking_stream_count == 0) { - if (sd->state == STREAM_DUCKING_STATE_DUCKING) - sd->state = STREAM_DUCKING_STATE_DUCKED; - else - sd->state = STREAM_DUCKING_STATE_UNDUCKED; + /* Send signal when all streams are ducked. + * Note that the condition of increasing count value below is located in + * handle_activate_ducking() of DBus handler. */ + if (sd->ducking_stream_count > 0 && --sd->ducking_stream_count == 0) { + if (sd->state == STREAM_DUCKING_STATE_DUCKING) + sd->state = STREAM_DUCKING_STATE_DUCKED; + else + sd->state = STREAM_DUCKING_STATE_UNDUCKED; - pa_log_info("send signal for ramp finished - state(%p,%d)", sd, sd->state); + pa_log_info("send signal for ramp finished - sd(%p, state:%d)", sd, sd->state); - send_ducking_state_changed_signal(pa_dbus_connection_get(m->dbus_conn), sd->trigger_index, is_stream_ducked(sd)); + send_ducking_state_changed_signal(pa_dbus_connection_get(m->dbus_conn), sd->trigger_index, is_stream_ducked(sd)); + } } return PA_HOOK_OK;