tizen-device: Change logic inside of _set_active_profile() 09/93609/1
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 25 Oct 2016 04:09:50 +0000 (13:09 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 25 Oct 2016 05:31:23 +0000 (14:31 +0900)
Previously, the callback for notifying active profile changed is called even if the third argument
of _set_active_profile() is false. In case of SCO open()/close() via device-manager API,
the callback get triggered in stream-manager and should be considiered with additional logic.
With this patch, the previous commit does not need anymore.
Fix build warning of stream-manager.c.

[Version] 5.0.87
[Profile] Common
[Issue Type] Feature Enhancement

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

index c40986135aa6be5800fb9e11acf3546a90e8aa38..4f8c354c859d8e6d9c1209d7494126303992132a 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.86
+Version:          5.0.87
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 9b063b69653f103ab4e234dbc34a6c19dcdbdf7e..37badeb9f43334aabc68d6655571f83a77134c84 100644 (file)
@@ -3179,7 +3179,7 @@ static void update_sink_or_source_as_device_change(stream_route_type_t stream_ro
                     }
                 } else if (!is_connected) {
                     /* DISCONNECTED: find a connected device that has the next priority */
-                    if (sink && (sink == ((pa_sink_input*)s)->sink) ||
+                    if ((sink && (sink == ((pa_sink_input*)s)->sink)) ||
                       /* FIX ME: Although A2DP of BT device is off and it changes to SCO, sink from the device should be same as BT sink(for A2DP).
                        * Because it does not work like that, new condition is added to avoid it temporarily. */
                         (pa_safe_streq(device_type, DEVICE_TYPE_BT) && pa_safe_streq(pa_tz_device_get_profile(device), "sco"))) {
@@ -3478,10 +3478,6 @@ static pa_hook_result_t device_profile_changed_hook_cb(pa_core *c, pa_tz_device_
                 bt_sink_available = true;  /* already bt device is connected and A2DP is newly activated */
         }
         if (device_direction & DM_DEVICE_DIRECTION_OUT) {
-            if (!bt_sink_available && pa_safe_streq(pa_tz_device_get_profile(conn->device), "sco")) {
-                pa_log_info("[SM][CONN] bt active profile is SCO, skip update others");
-                return PA_HOOK_OK;
-            }
             update_sink_or_source_as_device_change(STREAM_ROUTE_TYPE_AUTO, m->core->sink_inputs,
                                                    STREAM_SINK_INPUT, conn->device, bt_sink_available, m);
             update_sink_or_source_as_device_change(STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED, m->core->sink_inputs,
index 2eabac8ce908b8d578da069cf58d24aae5109847..26446a38207bf05f55e77fbb562bcd38cc39e554 100644 (file)
@@ -570,9 +570,8 @@ static pa_tz_profile* _get_active_profile(pa_tz_device *device) {
     return profile;
 }
 
-/* if noti_always is true, always noti this change without checking index
- * if profile is null, set first profile as active */
-int _set_active_profile(pa_tz_device *device, const char *profile, bool noti_always) {
+/* if profile is null, set first profile as active */
+int _set_active_profile(pa_tz_device *device, const char *profile, bool noti) {
     uint32_t profile_idx, prev_active_idx;
 
     pa_assert(device);
@@ -587,10 +586,9 @@ int _set_active_profile(pa_tz_device *device, const char *profile, bool noti_alw
         return -1;
     }
     device->active_profile = profile_idx;
-    pa_log_info("new active profile index %u", profile_idx);
+    pa_log_info("active profile index: prev(%u) -> new(%u)", prev_active_idx, profile_idx);
 
-    /* Compare index only when check_idx is true */
-    if (noti_always || prev_active_idx != device->active_profile)
+    if (noti)
         notify_device_profile_changed(device, PA_TZ_DEVICE_ACTIVE_PROFILE_CHANGED);
 
     return 0;