simple-endpoint-link: skip already output linked ports

This commit is contained in:
Julian Bouzas
2019-07-18 11:03:19 -04:00
committed by George Kiagiadakis
parent 4b6ea0de6e
commit c27c020a66

View File

@@ -229,9 +229,11 @@ simple_endpoint_link_create (WpEndpointLink * epl, GVariant * src_data,
if (in_direction == PW_DIRECTION_OUTPUT) if (in_direction == PW_DIRECTION_OUTPUT)
continue; 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))) if (g_hash_table_contains (linked_ports, GUINT_TO_POINTER(in_id)))
continue; continue;
if (g_hash_table_contains (linked_ports, GUINT_TO_POINTER(out_id)))
continue;
/* Create the properties */ /* Create the properties */
props = pw_properties_new(NULL, NULL); props = pw_properties_new(NULL, NULL);
@@ -248,8 +250,9 @@ simple_endpoint_link_create (WpEndpointLink * epl, GVariant * src_data,
self); self);
self->link_count++; 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(in_id), NULL);
g_hash_table_insert (linked_ports, GUINT_TO_POINTER(out_id), NULL);
/* Clean up */ /* Clean up */
pw_properties_free(props); pw_properties_free(props);