mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
media-session: use direction to find the node by name
Also use the stream direction when finding a node by name. We should only select nodes that have the right direction.
This commit is contained in:
parent
d37ea7851a
commit
b0068fd46b
2 changed files with 6 additions and 4 deletions
|
|
@ -1861,7 +1861,7 @@ static int link_nodes(struct impl *impl, struct endpoint_link *link,
|
|||
|
||||
inport = find_input_port(impl, outnode, outport, innode);
|
||||
if (inport == NULL) {
|
||||
pw_log_debug(NAME" %p: port %d:%d can't be linked", impl,
|
||||
pw_log_debug(NAME" %p: port %d:%d can't be linked, no input port", impl,
|
||||
outport->direction, outport->obj.id);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ static const char *get_device_name(struct node *node)
|
|||
return pw_properties_get(node->obj->obj.props, PW_KEY_NODE_NAME);
|
||||
}
|
||||
|
||||
static uint32_t find_device_for_name(struct impl *impl, const char *name)
|
||||
static uint32_t find_device_for_name(struct impl *impl, const char *name, enum spa_direction direction)
|
||||
{
|
||||
struct node *node;
|
||||
const char *str;
|
||||
|
|
@ -458,6 +458,8 @@ static uint32_t find_device_for_name(struct impl *impl, const char *name)
|
|||
return id;
|
||||
if ((str = get_device_name(node)) == NULL)
|
||||
continue;
|
||||
if (node->direction == direction)
|
||||
continue;
|
||||
if (spa_streq(str, name))
|
||||
return node->obj->obj.id;
|
||||
}
|
||||
|
|
@ -798,9 +800,9 @@ static int rescan_node(struct impl *impl, struct node *n)
|
|||
/* we always honour the target node asked for by the client */
|
||||
path_id = SPA_ID_INVALID;
|
||||
if ((str = spa_dict_lookup(props, PW_KEY_NODE_TARGET)) != NULL)
|
||||
path_id = find_device_for_name(impl, str);
|
||||
path_id = find_device_for_name(impl, str, n->direction);
|
||||
if (path_id == SPA_ID_INVALID && n->obj->target_node != NULL)
|
||||
path_id = find_device_for_name(impl, n->obj->target_node);
|
||||
path_id = find_device_for_name(impl, n->obj->target_node, n->direction);
|
||||
|
||||
pw_log_info("trying to link node %d exclusive:%d reconnect:%d target:%d follows-default:%d", n->id,
|
||||
exclusive, reconnect, path_id, follows_default);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue