else
p_idx = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
if (p_idx && !pa_atou(p_idx, &parent_idx)) {
- sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx);
- if (sp) {
- if (is_new_data)
- 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);
-
- 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 {
+ if (!(sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx))) {
pa_log_error("could not find matching client for this parent_id(%u)", parent_idx);
return false;
}
+ if (is_new_data)
+ 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);
+
+ 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);
}
/* set focus status regardless of parent id existence */
}
}
+static int exclude_device_filter_func(const void *device_type, const void *exclude_device_type) {
+ pa_assert(device_type);
+ pa_assert(exclude_device_type);
+
+ if (pa_safe_streq((const char*)device_type, (const char*)exclude_device_type)) {
+ pa_log_info("[%s] is excluded", (const char*)device_type);
+ return 0;
+ }
+
+ return 1;
+}
+
+static pa_idxset* get_avail_devices_except_bt_a2dp(pa_idxset *avail_devices) {
+ pa_idxset *filtered_devices;
+
+ pa_assert(avail_devices);
+
+ filtered_devices = pa_idxset_filtered_copy(avail_devices, NULL, exclude_device_filter_func, DEVICE_TYPE_BT_A2DP);
+
+ return filtered_devices;
+}
+
static void fill_device_info_to_hook_data(pa_stream_manager *m, void *hook_data, notify_command_type_t command, stream_type_t type, void *stream, bool is_new_data) {
char *device_none = NULL;
const char *p_idx = NULL;
avail_devices = (type == STREAM_SINK_INPUT) ? si->idx_avail_out_devices : si->idx_avail_in_devices;
list_len = pa_idxset_size(avail_devices);
device_none = pa_idxset_get_by_data(avail_devices, "none", NULL);
-
if (list_len == 0 || device_none) {
pa_log_warn(" -- there is no available device, stream_type(%d)", type);
break;
memset(&hook_call_select_data, 0, sizeof(pa_stream_manager_hook_data_for_select));
hook_call_select_data.stream = s = user_data;
if (s) {
+ pa_idxset *filtered_avail_devices = NULL;
hook_call_select_data.stream_type = type;
hook_call_select_data.origins_from_new_data = is_new_data;
if (is_new_data) {
hook_call_select_data.sample_spec = GET_STREAM_NEW_SAMPLE_SPEC(s, type);
if (type == STREAM_SINK_INPUT) {
hook_call_select_data.occupying_role = m->cur_highest_priority.role_si;
+ if (IS_ROLE_COMMUNICATION(hook_call_select_data.occupying_role)) {
+ /* Currently, if bt-sco is used by communication stream, other streams can not go with bt-a2dp.
+ Here we exclude bt-a2dp device type, therefore this stream can be mixed together by using another device */
+ filtered_avail_devices = get_avail_devices_except_bt_a2dp(hook_call_select_data.idx_avail_devices);
+ hook_call_select_data.idx_avail_devices = filtered_avail_devices;
+ }
hook_call_select_data.proper_sink = &(((pa_sink_input_new_data*)s)->sink);
/* need to check modifier_gain, because we do not skip a stream that is from module-sound-player */
modifier_gain = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(s, type), PA_PROP_MEDIA_TIZEN_VOLUME_GAIN_TYPE);
if (((pa_sink_input_new_data*)s)->sink && !modifier_gain) {
pa_log_info(" - sink(%s) has been already selected, skip selecting sink",
(((pa_sink_input_new_data*)s)->sink)->name);
- break;
+ goto BREAK_WITH_FREE;
}
} else if (type == STREAM_SOURCE_OUTPUT) {
hook_call_select_data.occupying_role = m->cur_highest_priority.role_so;
}
CONVERT_TO_DEVICE_ROLE(hook_call_select_data.stream_role, hook_call_select_data.device_role);
pa_hook_fire(pa_communicator_hook(m->comm.comm, PA_COMMUNICATOR_HOOK_SELECT_INIT_SINK_OR_SOURCE), &hook_call_select_data);
+BREAK_WITH_FREE:
+ pa_xfree(filtered_avail_devices);
}
break;
}