tizenaudio-policy: Refer to sound profile in case of ringtone-call playback 78/93978/6 accepted/tizen/3.0/common/20161114.105833 accepted/tizen/3.0/ivi/20161028.134045 accepted/tizen/3.0/mobile/20161028.133159 accepted/tizen/3.0/tv/20161028.133512 accepted/tizen/3.0/wearable/20161028.133802 accepted/tizen/common/20161026.134727 accepted/tizen/ivi/20161026.133414 accepted/tizen/mobile/20161026.133327 accepted/tizen/tv/20161026.133342 accepted/tizen/wearable/20161026.133358 submit/tizen/20161026.114941 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.082423 submit/tizen_3.0_common/20161104.104000
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 26 Oct 2016 11:07:00 +0000 (20:07 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 26 Oct 2016 11:44:23 +0000 (20:44 +0900)
If sound profile is off and ringtone-call stream is about to play,
it blocks the stream not to go out to builtin-speaker.

[Version] 5.0.88
[Profile] Common
[Issue Type] Policy

Change-Id: Ie93e3d5d875bba2bf66797c67a863e6621fda7a6
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/module-tizenaudio-policy.c
src/stream-manager.h

index 4f8c354..9c4f8de 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.87
+Version:          5.0.88
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 29c22a1..ab8c673 100644 (file)
@@ -323,6 +323,30 @@ static void update_loopback_module(struct userdata *u, bool load) {
     }
 }
 
+static bool skip_device(const char *stream_role, const char *device_type)
+{
+    int sound_on = 1;
+
+    if (pa_streq(device_type, DEVICE_TYPE_FORWARDING))
+        return true;
+
+    if (pa_streq(device_type, DEVICE_TYPE_BT))
+        return true;
+
+    /* get sound profile */
+    if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_on) < 0) {
+        pa_log_error("failed to get vconf - sound status");
+        return false;
+    }
+
+    if (!sound_on && pa_streq(stream_role, STREAM_ROLE_RINGTONE_CALL) && pa_streq(device_type, DEVICE_TYPE_SPEAKER)) {
+        pa_log_info("sound status is 0 with ringtone-call stream, skip built-in speaker");
+        return true;
+    }
+
+    return false;
+}
+
 /* Set the proper sink(source) according to the data of the parameter.
  * - ROUTE_TYPE_AUTO(_ALL)
  *     1. Find the proper sink/source comparing between avail_devices
@@ -703,10 +727,8 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                         pa_log_debug("  ** found a matched device: type[%-16s], direction[0x%x]", dm_device_type, dm_device_direction);
                         use_internal_codec = pa_tz_device_is_use_internal_codec(device);
                         if (use_internal_codec) {
-                            /* if the device type is forwarding, keep going to next device for proper UCM setting */
-                            if (pa_streq(dm_device_type, DEVICE_TYPE_FORWARDING))
-                                continue;
-                            if (pa_streq(dm_device_type, DEVICE_TYPE_BT))
+                            /* if it needs to skip it, keep going to next device for proper UCM setting */
+                            if (skip_device(data->stream_role, dm_device_type))
                                 continue;
                             hal_direction = CONVERT_TO_HAL_DIRECTION(data->stream_type);
                             route_info.num_of_devices++;
index 0fb6f23..b90d65b 100644 (file)
@@ -36,6 +36,7 @@
 #define GET_STREAM_PROPLIST(stream, type) \
       (type == STREAM_SINK_INPUT ? ((pa_sink_input*)stream)->proplist : ((pa_source_output*)stream)->proplist)
 
+#define STREAM_ROLE_RINGTONE_CALL       "ringtone-call"
 #define STREAM_ROLE_CALL_VOICE          "call-voice"
 #define STREAM_ROLE_CALL_VIDEO          "call-video"
 #define STREAM_ROLE_VOIP                "voip"