}
} 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"))) {
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,
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);
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;