From: Sangchul Lee Date: Tue, 25 Oct 2016 04:09:50 +0000 (+0900) Subject: tizen-device: Change logic inside of _set_active_profile() X-Git-Tag: submit/tizen/20161026.114941~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=140e95a061729a8b9c4bcc31bf717c3d10bc835c;p=platform%2Fcore%2Fmultimedia%2Fpulseaudio-modules-tizen.git tizen-device: Change logic inside of _set_active_profile() 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 --- diff --git a/packaging/pulseaudio-modules-tizen.spec b/packaging/pulseaudio-modules-tizen.spec index c409861..4f8c354 100644 --- a/packaging/pulseaudio-modules-tizen.spec +++ b/packaging/pulseaudio-modules-tizen.spec @@ -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+ diff --git a/src/stream-manager.c b/src/stream-manager.c index 9b063b6..37badeb 100644 --- a/src/stream-manager.c +++ b/src/stream-manager.c @@ -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, diff --git a/src/tizen-device.c b/src/tizen-device.c index 2eabac8..26446a3 100644 --- a/src/tizen-device.c +++ b/src/tizen-device.c @@ -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;