mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
media-session: try to connect to the node directly
If we can't find a session for the target node, try to connect to the node directly if it exists.
This commit is contained in:
parent
093c675995
commit
ee72023629
1 changed files with 21 additions and 9 deletions
|
|
@ -930,6 +930,7 @@ static int rescan_node(struct impl *impl, struct node *node)
|
|||
struct spa_audio_info_raw audio_info = { 0, };
|
||||
struct spa_pod *param;
|
||||
char buf[1024];
|
||||
int n_links = 0;
|
||||
|
||||
if (node->type == NODE_TYPE_DSP || node->type == NODE_TYPE_DEVICE)
|
||||
return 0;
|
||||
|
|
@ -1006,6 +1007,13 @@ static int rescan_node(struct impl *impl, struct node *node)
|
|||
else
|
||||
return -EINVAL;
|
||||
|
||||
if (strcmp(category, "Capture") == 0)
|
||||
direction = PW_DIRECTION_OUTPUT;
|
||||
else if (strcmp(category, "Playback") == 0)
|
||||
direction = PW_DIRECTION_INPUT;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
str = spa_dict_lookup(props, PW_NODE_PROP_TARGET_NODE);
|
||||
if (str != NULL)
|
||||
find.path_id = atoi(str);
|
||||
|
|
@ -1022,6 +1030,15 @@ static int rescan_node(struct impl *impl, struct node *node)
|
|||
spa_list_for_each(session, &impl->session_list, l)
|
||||
find_session(&find, session);
|
||||
|
||||
if (find.sess == NULL && find.path_id != SPA_ID_INVALID) {
|
||||
pw_log_debug(NAME " %p: no session found for %d, try node", impl, node->obj.id);
|
||||
|
||||
n_links = 1;
|
||||
peer = find_object(impl, find.path_id);
|
||||
if (peer != NULL)
|
||||
goto do_link;
|
||||
}
|
||||
|
||||
if (find.sess == NULL) {
|
||||
struct client *client;
|
||||
|
||||
|
|
@ -1042,13 +1059,6 @@ static int rescan_node(struct impl *impl, struct node *node)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(category, "Capture") == 0)
|
||||
direction = PW_DIRECTION_OUTPUT;
|
||||
else if (strcmp(category, "Playback") == 0)
|
||||
direction = PW_DIRECTION_INPUT;
|
||||
else
|
||||
return -EINVAL;
|
||||
|
||||
if (exclusive || session->dsp == NULL) {
|
||||
if (exclusive && session->busy) {
|
||||
pw_log_warn(NAME" %p: session %d busy, can't get exclusive access", impl, session->id);
|
||||
|
|
@ -1088,10 +1098,12 @@ static int rescan_node(struct impl *impl, struct node *node)
|
|||
SPA_PARAM_Profile, 0, param);
|
||||
|
||||
stream_set_volume(impl, node, 1.0, false);
|
||||
n_links = audio_info.channels;
|
||||
} else {
|
||||
audio_info.channels = 1;
|
||||
n_links = audio_info.channels = 1;
|
||||
}
|
||||
link_nodes(peer, direction, node, audio_info.channels);
|
||||
do_link:
|
||||
link_nodes(peer, direction, node, n_links);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue