From c27c020a6621930075af8aaaa99da71fa497014c Mon Sep 17 00:00:00 2001 From: Julian Bouzas Date: Thu, 18 Jul 2019 11:03:19 -0400 Subject: [PATCH] simple-endpoint-link: skip already output linked ports --- modules/module-pipewire/simple-endpoint-link.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/module-pipewire/simple-endpoint-link.c b/modules/module-pipewire/simple-endpoint-link.c index 895d8063..a64b3b5f 100644 --- a/modules/module-pipewire/simple-endpoint-link.c +++ b/modules/module-pipewire/simple-endpoint-link.c @@ -229,9 +229,11 @@ simple_endpoint_link_create (WpEndpointLink * epl, GVariant * src_data, if (in_direction == PW_DIRECTION_OUTPUT) continue; - /* Skip the port if it is already linked */ + /* Skip the ports if they are already linked */ if (g_hash_table_contains (linked_ports, GUINT_TO_POINTER(in_id))) continue; + if (g_hash_table_contains (linked_ports, GUINT_TO_POINTER(out_id))) + continue; /* Create the properties */ props = pw_properties_new(NULL, NULL); @@ -248,8 +250,9 @@ simple_endpoint_link_create (WpEndpointLink * epl, GVariant * src_data, self); self->link_count++; - /* Insert the port id in the hash table to know it is linked */ + /* Insert the port ids in the hash tables to know they are linked */ g_hash_table_insert (linked_ports, GUINT_TO_POINTER(in_id), NULL); + g_hash_table_insert (linked_ports, GUINT_TO_POINTER(out_id), NULL); /* Clean up */ pw_properties_free(props);