Fix sound leakage for a short time after handling power-off signal 40/112640/1 tizen_3.0_tv accepted/tizen/3.0/common/20170203.150902 accepted/tizen/3.0/ivi/20170203.090337 accepted/tizen/3.0/mobile/20170203.090125 accepted/tizen/3.0/tv/20170203.090234 accepted/tizen/3.0/wearable/20170203.090307 submit/tizen_3.0/20170202.094603
authorHyunseok Lee <hs7388.lee@samsung.com>
Thu, 2 Feb 2017 05:28:50 +0000 (14:28 +0900)
committerHyunseok Lee <hs7388.lee@samsung.com>
Thu, 2 Feb 2017 05:28:50 +0000 (14:28 +0900)
[Version] 5.0.129
[Profile] Common
[Issue Type] Bug

Change-Id: I5c38ef8bded06fc93b3c2be9f86b558f806cdf9b

packaging/pulseaudio-modules-tizen.spec
src/module-poweroff.c

index 298c7aa..0d62851 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.128
+Version:          5.0.129
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index e5ced63..a410940 100644 (file)
@@ -75,7 +75,7 @@ struct userdata {
     pa_dbus_connection *dbus_conn;
     pa_hal_interface *hal_interface;
     bool is_poweroff;
-    pa_hook_slot *sink_input_put_slot;
+    pa_hook_slot *sink_input_new_slot;
 };
 
 static void mute_all_streams(struct userdata *u)
@@ -86,7 +86,7 @@ static void mute_all_streams(struct userdata *u)
     hal_route_option route_option;
 
     PA_IDXSET_FOREACH(si, u->module->core->sink_inputs, idx) {
-       pa_log_info("POWEROFF : mute sink-input(%d)", idx);
+        pa_log_info("POWEROFF : mute sink-input(%d)", idx);
 
         /* FIXME : Any exceptions for mute? */
         pa_sink_input_set_mute(si, true, false);
@@ -104,21 +104,20 @@ static void mute_all_streams(struct userdata *u)
     }
 }
 
-static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
+static pa_hook_result_t sink_input_new_cb(pa_core *core, pa_sink_input_new_data *new_data, struct userdata *u) {
     const char *vol_gain_type = NULL;
 
     pa_core_assert_ref(core);
-    pa_sink_input_assert_ref(i);
 
     if (!u->is_poweroff)
         return PA_HOOK_OK;
 
-    vol_gain_type = pa_proplist_gets(i->proplist, PA_PROP_MEDIA_TIZEN_VOLUME_GAIN_TYPE);
+    vol_gain_type = pa_proplist_gets(new_data->proplist, PA_PROP_MEDIA_TIZEN_VOLUME_GAIN_TYPE);
     if (pa_safe_streq(vol_gain_type, BOOT_GAIN_TYPE)) {
-        pa_log_info(" sink-input(%d) is [%s], ignore mute", i->index, BOOT_GAIN_TYPE);
+        pa_log_info(" ignore mute for gain [%s]", BOOT_GAIN_TYPE);
     } else {
-        pa_log_info(" Mute sink-input(%d) due to POWEROFF", i->index);
-        pa_sink_input_set_mute(i, true, false);
+        pa_log_info(" Mute sink-input due to POWEROFF");
+        pa_sink_input_new_data_set_muted(new_data, true);
     }
 
     return PA_HOOK_OK;
@@ -251,7 +250,7 @@ int pa__init(pa_module *m) {
     }
 
     u->hal_interface = pa_hal_interface_get(u->module->core);
-    u->sink_input_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_put_cb, u);
+    u->sink_input_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_new_cb, u);
 
     return 0;
 }
@@ -264,8 +263,8 @@ void pa__done(pa_module *m) {
     if (!(u = m->userdata))
         return;
 
-    if (u->sink_input_put_slot)
-        pa_hook_slot_free(u->sink_input_put_slot);
+    if (u->sink_input_new_slot)
+        pa_hook_slot_free(u->sink_input_new_slot);
 
     if (u->hal_interface)
         pa_hal_interface_unref(u->hal_interface);