Skip update routing when notification comes while radio is highest priority stream 29/105429/2
authorSeungbae Shin <seungbae.shin@samsung.com>
Fri, 16 Dec 2016 12:10:13 +0000 (21:10 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Sat, 17 Dec 2016 10:43:23 +0000 (19:43 +0900)
[Version] 5.0.107
[Profile] Common
[Issue Type] PLM

Change-Id: I4627718302ed8369203c5aed725fa47e1e822ece

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

index 15e1b6b..73770c6 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.106
+Version:          5.0.107
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index e71fa19..6b503dc 100644 (file)
@@ -1879,6 +1879,25 @@ static bool update_volume_type_of_stream(pa_stream_manager *m, void *stream, str
     return ret;
 }
 
+/* FIXME : this code is workaround code and needed to be revised soon */
+static void _enable_focus_status_if_radio(void *stream, stream_type_t type, bool is_new_data)
+{
+    const char *prop_media_role = NULL;
+    pa_proplist* p = NULL;
+
+    p = (is_new_data ? GET_STREAM_NEW_PROPLIST(stream, type) : GET_STREAM_PROPLIST(stream, type));
+    if (!p)
+        return;
+
+    prop_media_role = pa_proplist_gets(p, PA_PROP_MEDIA_ROLE);
+    if (prop_media_role) {
+       if (pa_safe_streq(prop_media_role, STREAM_ROLE_RADIO)) {
+            pa_log_info("This stream is radio, update focus status to 1");
+            pa_proplist_setf(p, PA_PROP_MEDIA_FOCUS_STATUS, "%u", 1);
+        }
+    }
+}
+
 static bool update_focus_status_of_stream(pa_stream_manager *m, void *stream, stream_type_t type, bool is_new_data) {
     const char *p_idx;
     uint32_t parent_idx = 0;
@@ -1898,6 +1917,10 @@ static bool update_focus_status_of_stream(pa_stream_manager *m, void *stream, st
                 pa_proplist_setf(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_FOCUS_STATUS, "%u", sp->focus_status);
             else
                 pa_proplist_setf(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_FOCUS_STATUS, "%u", sp->focus_status);
+
+            /* FIXME : If stream is radio, then fix focus_status to 1 */
+            _enable_focus_status_if_radio(stream, type, is_new_data);
+
             pa_log_debug("p_idx(%s), idx(%u), focus_status(0x%x, 0x1:playback 0x2:capture 0x3:both)", p_idx, parent_idx, sp->focus_status);
         } else {
             pa_log_error("could not find matching client for this parent_id(%u)", parent_idx);