Update route option for Radio Mute when Earjack is disconnected 57/105057/2 accepted/tizen/3.0/common/20161216.123409 accepted/tizen/3.0/ivi/20161216.015532 accepted/tizen/3.0/mobile/20161216.015442 accepted/tizen/3.0/tv/20161216.015508 accepted/tizen/3.0/wearable/20161216.015511 submit/tizen_3.0/20161215.083256
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 15 Dec 2016 07:30:39 +0000 (16:30 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Thu, 15 Dec 2016 08:30:50 +0000 (17:30 +0900)
[Version] 5.0.106
[Profile] Common
[Issue Type] PLM

Change-Id: I58518d0078a74be871bdf048a8e7c50ec4a3c6d0

packaging/pulseaudio-modules-tizen.spec
src/communicator.c
src/stream-manager.c

index c2ef6c3..15e1b6b 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.105
+Version:          5.0.106
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index da5f96b..47a197f 100644 (file)
@@ -49,7 +49,7 @@ pa_communicator* pa_communicator_get(pa_core *core) {
     c->core = core;
 
     for (i = 0; i < PA_COMMUNICATOR_HOOK_MAX; i++)
-        pa_hook_init(&c->hooks[i], c);
+        pa_hook_init(&c->hooks[i], core);
 
     pa_shared_set(core, SHARED_COMMUNICATOR, c);
 
index 34e298a..e71fa19 100644 (file)
@@ -3459,6 +3459,11 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_tz_devi
     pa_sink *sink = NULL;
     pa_source *source = NULL;
 
+    pa_sink_input *si = NULL;
+    uint32_t si_idx = 0;
+    const char *media_role = NULL;
+    hal_route_option route_option;
+
     pa_assert(c);
     pa_assert(data);
     pa_assert(m);
@@ -3472,10 +3477,27 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_tz_devi
                 data->event_id, data->is_connected, data->device, device_type, device_id, device_direction, use_internal_codec);
 
     /* mute all the streams belong to this device, those will be un-muted in event_fully_handled_hook_cb */
-    if (!data->is_connected && (device_direction & DM_DEVICE_DIRECTION_OUT))
+    if (!data->is_connected && (device_direction & DM_DEVICE_DIRECTION_OUT)) {
         if ((sink = pa_tz_device_get_sink(data->device, DEVICE_ROLE_NORMAL)))
             mute_sink_inputs_as_device_disconnection(m, data->event_id, true, sink->inputs);
 
+        /* If Earjack is disconnected, search for sink-input which has radio role,
+           if found, let radio mute to avoid intermediate noise */
+        if (pa_safe_streq(device_type, DEVICE_TYPE_AUDIO_JACK)) {
+            PA_IDXSET_FOREACH(si, c->sink_inputs, si_idx) {
+                media_role = pa_proplist_gets(si->proplist, PA_PROP_MEDIA_ROLE);
+                if (pa_safe_streq(media_role, STREAM_ROLE_RADIO)) {
+                    pa_log_info(" sink-input(%d) is radio, let HAL mute for disconnect of earjack", si->index);
+                    memset(&route_option, 0, sizeof(hal_route_option));
+                    route_option.role = STREAM_ROLE_RADIO;
+                    route_option.name = "mute";
+                    route_option.value = 1;
+                    pa_hal_interface_update_route_option(m->hal, &route_option);
+                }
+            }
+        }
+    }
+
     /* Update streams belong to this external device that have MAUAL_EXT route type */
     if (!use_internal_codec && (device_direction & DM_DEVICE_DIRECTION_IN)) {
         if ((source = pa_tz_device_get_source(data->device, DEVICE_ROLE_NORMAL)))