From ae85a3da3964fe1e5fb68430b7198f49cef20ed5 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 23 Mar 2021 16:36:46 +0100 Subject: [PATCH] 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. --- src/examples/media-session/policy-node.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/examples/media-session/policy-node.c b/src/examples/media-session/policy-node.c index 7ed73e9a5..3e06462d7 100644 --- a/src/examples/media-session/policy-node.c +++ b/src/examples/media-session/policy-node.c @@ -615,6 +615,7 @@ static int link_nodes(struct node *node, struct node *peer) struct impl *impl = node->impl; struct pw_properties *props; struct node *output, *input; + int res; pw_log_debug(NAME " %p: link nodes %d %d remix:%d", impl, 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_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->connect_count++; } pw_properties_free(props); - return 0; + return res; } static int unlink_nodes(struct node *node, struct node *peer)