mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
media-session: make link_nodes return the number of links
Return the result from sm_media_session_create_links() as the result of link_nodes. This is > 0 when something was linked, < 0 on error and 0 when no ports are available. We should be able to use this result later to handle errors.
This commit is contained in:
parent
df9644f109
commit
ae85a3da39
1 changed files with 4 additions and 2 deletions
|
|
@ -615,6 +615,7 @@ static int link_nodes(struct node *node, struct node *peer)
|
||||||
struct impl *impl = node->impl;
|
struct impl *impl = node->impl;
|
||||||
struct pw_properties *props;
|
struct pw_properties *props;
|
||||||
struct node *output, *input;
|
struct node *output, *input;
|
||||||
|
int res;
|
||||||
|
|
||||||
pw_log_debug(NAME " %p: link nodes %d %d remix:%d", impl,
|
pw_log_debug(NAME " %p: link nodes %d %d remix:%d", impl,
|
||||||
node->id, peer->id, !node->dont_remix);
|
node->id, peer->id, !node->dont_remix);
|
||||||
|
|
@ -637,13 +638,14 @@ static int link_nodes(struct node *node, struct node *peer)
|
||||||
pw_properties_setf(props, PW_KEY_LINK_INPUT_NODE, "%d", input->id);
|
pw_properties_setf(props, PW_KEY_LINK_INPUT_NODE, "%d", input->id);
|
||||||
pw_log_info("linking node %d to node %d", output->id, input->id);
|
pw_log_info("linking node %d to node %d", output->id, input->id);
|
||||||
|
|
||||||
if (sm_media_session_create_links(impl->session, &props->dict) > 0) {
|
res = sm_media_session_create_links(impl->session, &props->dict);
|
||||||
|
if (res > 0) {
|
||||||
node->peer = peer;
|
node->peer = peer;
|
||||||
node->connect_count++;
|
node->connect_count++;
|
||||||
}
|
}
|
||||||
pw_properties_free(props);
|
pw_properties_free(props);
|
||||||
|
|
||||||
return 0;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unlink_nodes(struct node *node, struct node *peer)
|
static int unlink_nodes(struct node *node, struct node *peer)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue