stream-manager: Skip invalid streams before invoking pa_sink_input_remove_volume_factor() 63/217663/1
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 13 Nov 2019 07:19:46 +0000 (16:19 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 13 Nov 2019 07:24:30 +0000 (16:24 +0900)
It is added temporarily to avoid crash. It will be removed if we find
the crash case due to the omission of removal of stream index from
idx_ducking_streams and fix it.

[Version] 11.1.87
[Issue Type] Crash

Change-Id: I5aa655240a951019750da1ae1941790c08c77bd7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/stream-manager-dbus.c
src/stream-manager.c

index ff8af3f..a011caa 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          11.1.86
+Version:          11.1.87
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index d4deb67..972c6d6 100644 (file)
@@ -1926,7 +1926,7 @@ static void handle_activate_ducking(DBusConnection *conn, DBusMessage *msg, void
 
             pa_idxset_put(sd->idx_ducking_streams, (void *)i, NULL);
 
-            pa_log_info("ducking: add volume_ramp factor, key[%s], set_vol[%u] to stream[idx:%u]",
+            pa_log_error("ducking: add volume_ramp factor, key[%s], set_vol[%u] to stream[idx:%u]",
                 sd->vol_key, sd->set_vol, i->index);
 
             pa_cvolume_ramp_set(&vol_ramp, i->volume.channels,
@@ -1941,7 +1941,7 @@ static void handle_activate_ducking(DBusConnection *conn, DBusMessage *msg, void
                 pa_sink_input_add_volume_ramp_factor(i, sd->vol_key, &vol_ramp, true);
             }
         } else {
-            pa_log_info("unducking: remove volume(ramp) factor, key[%s] from stream[idx:%u]",
+            pa_log_error("unducking: remove volume(ramp) factor, key[%s] from stream[idx:%u]",
                 sd->vol_key, i->index);
 
             pa_sink_input_remove_volume_factor(i, sd->vol_key);
index bc49ef7..0815d10 100644 (file)
@@ -2389,7 +2389,7 @@ static void remove_sink_input_from_ducking_streams(pa_stream_manager *m, pa_sink
                 (!strlen(sd->target_role) && sd->is_ducked))
                 pa_hook_fire(&i->core->hooks[PA_CORE_HOOK_SINK_INPUT_RAMP_FINISH], i);
 
-            pa_log_info("remove stream(idx:%u,%p) from idx_ducking_streams, trigger_index(%u)",
+            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);
 
@@ -2412,7 +2412,7 @@ static void add_sink_input_to_ducking_streams(pa_stream_manager *m, pa_sink_inpu
         if (!pa_safe_streq(sd->target_role, pa_proplist_gets(i->proplist, PA_PROP_MEDIA_ROLE)))
             continue;
 
-        pa_log_info("add stream(idx:%u,%p) to idx_ducking_streams, trigger_index(%u), volume(%u)",
+        pa_log_error("add stream(idx:%u,%p) to idx_ducking_streams, trigger_index(%u), volume(%u)",
             i->index, i, sd->trigger_index, sd->set_vol);
 
         pa_idxset_put(sd->idx_ducking_streams, (void *)i, NULL);
@@ -3491,6 +3491,11 @@ static void subscribe_cb(pa_core *core, pa_subscription_event_type_t t, uint32_t
 
             PA_IDXSET_FOREACH(stream, sd->idx_ducking_streams, ducking_idx) {
                 hal_ducking_activation_info ducking_activation_info;
+                /* Note: It is added temporarily to find missing index of idx_ducking_streams */
+                if (!pa_idxset_get_by_data(m->core->sink_inputs, stream, NULL)) {
+                    pa_log_error("could not find stream(%p), skip it", stream);
+                    continue;
+                }
 
                 pa_log_info(" -- remove volume ramp, key(%s) from remained stream(idx:%u)", sd->vol_key, stream->index);
                 pa_sink_input_remove_volume_factor(stream, sd->vol_key);