Revert "media-session: use direction to find the node by name"

This reverts commit b0068fd46b.

It breaks recording from monitor ports.
This commit is contained in:
Wim Taymans 2021-06-03 20:31:49 +02:00
parent 669fbf10c1
commit 0ba9402d4b
2 changed files with 4 additions and 6 deletions

View file

@ -1854,7 +1854,7 @@ static int link_nodes(struct impl *impl, struct endpoint_link *link,
inport = find_input_port(impl, outnode, outport, innode); inport = find_input_port(impl, outnode, outport, innode);
if (inport == NULL) { if (inport == NULL) {
pw_log_debug(NAME" %p: port %d:%d can't be linked, no input port", impl, pw_log_debug(NAME" %p: port %d:%d can't be linked", impl,
outport->direction, outport->obj.id); outport->direction, outport->obj.id);
continue; continue;
} }

View file

@ -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); 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, enum spa_direction direction) static uint32_t find_device_for_name(struct impl *impl, const char *name)
{ {
struct node *node; struct node *node;
const char *str; const char *str;
@ -458,8 +458,6 @@ static uint32_t find_device_for_name(struct impl *impl, const char *name, enum s
return id; return id;
if ((str = get_device_name(node)) == NULL) if ((str = get_device_name(node)) == NULL)
continue; continue;
if (node->direction == direction)
continue;
if (spa_streq(str, name)) if (spa_streq(str, name))
return node->obj->obj.id; return node->obj->obj.id;
} }
@ -800,9 +798,9 @@ static int rescan_node(struct impl *impl, struct node *n)
/* we always honour the target node asked for by the client */ /* we always honour the target node asked for by the client */
path_id = SPA_ID_INVALID; path_id = SPA_ID_INVALID;
if ((str = spa_dict_lookup(props, PW_KEY_NODE_TARGET)) != NULL) if ((str = spa_dict_lookup(props, PW_KEY_NODE_TARGET)) != NULL)
path_id = find_device_for_name(impl, str, n->direction); path_id = find_device_for_name(impl, str);
if (path_id == SPA_ID_INVALID && n->obj->target_node != NULL) if (path_id == SPA_ID_INVALID && n->obj->target_node != NULL)
path_id = find_device_for_name(impl, n->obj->target_node, n->direction); path_id = find_device_for_name(impl, n->obj->target_node);
pw_log_info("trying to link node %d exclusive:%d reconnect:%d target:%d follows-default:%d", n->id, 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); exclusive, reconnect, path_id, follows_default);