/* move sink-inputs/source-outputs if needed */
if (data->idx_streams) {
PA_IDXSET_FOREACH(s, data->idx_streams, s_idx) { /* data->idx_streams: null_sink */
- if (!pa_stream_manager_get_route_type(s, false, data->stream_type, &route_type) &&
+ if (!pa_stream_manager_get_route_type(s, data->stream_type, false, &route_type) &&
(route_type == STREAM_ROUTE_TYPE_AUTO_ALL)) {
if ((data->stream_type == STREAM_SINK_INPUT) && (sink && (sink != ((pa_sink_input*)s)->sink))) {
pa_sink_input_move_to(s, sink, false);
}
}
- /* move other streams that are belong to device of NORMAL role
- * to a proper sink/source if needed */
- if (device && data->stream && data->origins_from_new_data &&
- data->route_type == STREAM_ROUTE_TYPE_MANUAL) {
+ /* move stream(s) to a proper sink/source if needed */
+ if (device && data->stream && data->origins_from_new_data) {
+
if (pa_streq(data->stream_role, STREAM_ROLE_CALL_VOICE)) {
if (data->stream_type == STREAM_SINK_INPUT) {
if (!(sink = pa_device_manager_get_sink(device, DEVICE_ROLE_NORMAL)) ||
else
streams = source->outputs;
}
+ /* move other streams that belong to the device of NORMAL role */
if (streams) {
PA_IDXSET_FOREACH(s, streams, idx) {
if (data->stream_type == STREAM_SINK_INPUT) {
else if(data->stream_type == STREAM_SOURCE_OUTPUT)
pa_source_suspend(source, true, PA_SUSPEND_INTERNAL);
}
+
+ } else if (pa_streq(data->stream_role, STREAM_ROLE_RADIO)) {
+ if (data->stream_type == STREAM_SINK_INPUT &&
+ pa_stream_manager_check_name_is_vstream(data->stream, STREAM_SINK_INPUT, true)) {
+ if ((sink = pa_device_manager_get_sink(device, data->device_role))) {
+ *(data->proper_sink) = sink;
+ pa_log_debug("[ROUTE][RADIO] *** now, sink-input(%p,%u) uses the sink(%p,%s)",
+ data->stream, ((pa_sink_input*)data->stream)->index, sink, sink->name);
+ }
+ }
}
}
if (data->idx_streams) {
PA_IDXSET_FOREACH(s, data->idx_streams, idx) {
if (sink && sink != ((pa_sink_input*)s)->sink) {
+ if ((pa_stream_manager_check_name_is_vstream(s, STREAM_SINK_INPUT, false)))
+ continue;
if (((combine_sink = (pa_sink*)pa_namereg_get(u->core, SINK_NAME_COMBINED, PA_NAMEREG_SINK)) &&
((pa_sink_input*)s)->sink == combine_sink))
break;
static void do_notify(pa_stream_manager *m, notify_command_type_t command, stream_type_t type, bool is_new_data, void *user_data);
static process_stream_result_t process_stream(pa_stream_manager *m, void *stream, stream_type_t type, process_command_type_t command, bool is_new_data);
-static int get_available_streams(pa_stream_manager *m, stream_list *list) {
+static int32_t get_available_streams(pa_stream_manager *m, stream_list *list) {
void *state = NULL;
stream_info *s = NULL;
char *role = NULL;
return 0;
}
-static int get_stream_info(pa_stream_manager *m, const char *stream_role, stream_info_per_type *info) {
+static int32_t get_stream_info(pa_stream_manager *m, const char *stream_role, stream_info_per_type *info) {
uint32_t idx = 0;
char *name;
int i = 0;
}
#endif
-static int convert_route_type(stream_route_type_t *route_type, const char *route_type_string) {
+static int32_t convert_route_type(stream_route_type_t *route_type, const char *route_type_string) {
int ret = 0;
pa_assert(route_type);
return ret;
}
+static int32_t get_route_type(void *stream, stream_type_t stream_type, bool is_new_data, stream_route_type_t *stream_route_type) {
+ const char *route_type_str = NULL;
+
+ pa_assert(stream);
+ pa_assert(stream_route_type);
+
+ if (is_new_data)
+ route_type_str = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(stream, stream_type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
+ else
+ route_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(stream, stream_type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
+ if (!route_type_str) {
+ pa_log_warn("could not get route type from the stream(%p)", stream);
+ return -1;
+ }
+
+ if (pa_atoi(route_type_str, (int32_t*)stream_route_type)) {
+ pa_log_error("could not convert route_type_str(%s) to int", route_type_str);
+ return -1;
+ }
+
+ return 0;
+}
+
static void dump_stream_map(pa_stream_manager *m) {
stream_info *s = NULL;
const char *role = NULL;
pa_log_info("[SM][PROCESS_STREAM_FOR_AUTO] stream(%p), stream_type(%d), is_connected(%d), use_internal_codec(%d)",
stream, stream_type, is_connected, use_internal_codec);
- if (pa_stream_manager_get_route_type(stream, false, stream_type, &route_type) ||
+ if (get_route_type(stream, stream_type, false, &route_type) ||
(route_type != STREAM_ROUTE_TYPE_AUTO && route_type != STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED))
return;
source = pa_device_manager_get_source(device, DEVICE_ROLE_NORMAL);
PA_IDXSET_FOREACH(s, streams, s_idx) { /* streams: core->source_outputs/core->sink_inputs */
- if (!pa_stream_manager_get_route_type(s, false, stream_type, &route_type) && (route_type == stream_route_type)) {
+ if (!get_route_type(s, stream_type, false, &route_type) && (route_type == stream_route_type)) {
role = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_ROLE);
pa_log_debug(" -- idx(%u), route_type(%d), role(%s)", s_idx, route_type, role);
if (is_connected) {
pa_log_info("[SM][UPDATE_SINK_SOURCE][EXT] deivce_type(%s), is_connected(%d))", device_type, is_connected);
if (!is_connected) {
PA_IDXSET_FOREACH(s, streams, s_idx) { /* streams: source->outputs/sink->inputs */
- if (!pa_stream_manager_get_route_type(s, false, stream_type, &route_type) && route_type == stream_route_type) {
+ if (!get_route_type(s, stream_type, false, &route_type) && route_type == stream_route_type) {
if (stream_type == STREAM_SOURCE_OUTPUT) {
/* move it to null source if this role is for external device */
pa_source_output_move_to((pa_source_output*)s, null_source, false);
/* If the route type of the stream is not manual, notify again */
if (m->cur_highest_priority.source_output && (device_direction & DM_DEVICE_DIRECTION_IN)) {
- if (!pa_stream_manager_get_route_type(m->cur_highest_priority.source_output, false, STREAM_SOURCE_OUTPUT, &route_type)) {
+ if (!get_route_type(m->cur_highest_priority.source_output, STREAM_SOURCE_OUTPUT, false, &route_type)) {
if (route_type < STREAM_ROUTE_TYPE_MANUAL) {
if (use_internal_codec) {
PA_IDXSET_FOREACH(s, m->cur_highest_priority.source_output->source->outputs, s_idx) {
- if (!data->is_connected && !pa_stream_manager_get_route_type(s, false, STREAM_SOURCE_OUTPUT, &route_type) &&
+ if (!data->is_connected && !get_route_type(s, STREAM_SOURCE_OUTPUT, false, &route_type) &&
((route_type == STREAM_ROUTE_TYPE_AUTO) || (route_type == STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED))) {
/* remove activated device info. if it has the AUTO route type */
active_dev = pa_proplist_gets(GET_STREAM_PROPLIST(s, STREAM_SOURCE_OUTPUT), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV);
}
}
if (m->cur_highest_priority.sink_input && (device_direction & DM_DEVICE_DIRECTION_OUT)) {
- if (!pa_stream_manager_get_route_type(m->cur_highest_priority.sink_input, false, STREAM_SINK_INPUT, &route_type)) {
+ if (!get_route_type(m->cur_highest_priority.sink_input, STREAM_SINK_INPUT, false, &route_type)) {
if (route_type < STREAM_ROUTE_TYPE_MANUAL) {
if (use_internal_codec) {
PA_IDXSET_FOREACH(s, m->cur_highest_priority.sink_input->sink->inputs, s_idx) {
- if (!data->is_connected && !pa_stream_manager_get_route_type(s, false, STREAM_SINK_INPUT, &route_type) &&
+ if (!data->is_connected && !get_route_type(s, STREAM_SINK_INPUT, false, &route_type) &&
((route_type == STREAM_ROUTE_TYPE_AUTO) || (route_type == STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED))) {
/* remove activated device info. if it has the AUTO route type */
active_dev = pa_proplist_gets(GET_STREAM_PROPLIST(s, STREAM_SINK_INPUT), PA_PROP_MEDIA_ROUTE_AUTO_ACTIVE_DEV);
}
}
+/* Message callback from HAL interface */
static void message_cb(const char *name, int value, void *user_data) {
pa_stream_manager *m;
pa_stream_manager_hook_data_for_update_info hook_call_data;
m = (pa_stream_manager*)user_data;
+ /* For module-loopback parameters */
if (strstr(name, STREAM_ROLE_LOOPBACK)) {
memset(&hook_call_data, 0, sizeof(pa_stream_manager_hook_data_for_update_info));
hook_call_data.stream_role = STREAM_ROLE_LOOPBACK;
pa_hook_fire(pa_communicator_hook(m->comm.comm, PA_COMMUNICATOR_HOOK_UPDATE_INFORMATION), &hook_call_data);
}
#ifdef HAVE_DBUS
+ /* Others */
else {
send_command_signal(pa_dbus_connection_get(m->dbus_conn), name, value);
}
return;
}
-static int init_ipc(pa_stream_manager *m) {
+static int32_t init_ipc(pa_stream_manager *m) {
DBusError err;
pa_dbus_connection *conn = NULL;
static const DBusObjectPathVTable vtable = {
return;
}
-int32_t pa_stream_manager_get_route_type(void *stream, bool origins_from_new_data, stream_type_t stream_type, stream_route_type_t *stream_route_type) {
- const char *route_type_str = NULL;
-
- pa_assert(stream);
- pa_assert(stream_route_type);
-
- if (origins_from_new_data)
- route_type_str = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(stream, stream_type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
- else
- route_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(stream, stream_type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
- if (!route_type_str) {
- pa_log_warn("could not get route type from the stream(%p)", stream);
- return -1;
- }
-
- if (pa_atoi(route_type_str, (int32_t*)stream_route_type)) {
- pa_log_error("could not convert route_type_str(%s) to int", route_type_str);
- return -1;
- }
+bool pa_stream_manager_check_name_is_vstream(void *stream, stream_type_t type, bool is_new_data) {
+ return check_name_is_vstream(stream, type, is_new_data);
+}
- return 0;
+int32_t pa_stream_manager_get_route_type(void *stream, stream_type_t stream_type, bool is_new_data, stream_route_type_t *stream_route_type) {
+ return get_route_type(stream, stream_type, is_new_data, stream_route_type);
}
pa_stream_manager* pa_stream_manager_init(pa_core *c) {