From 33f90abfb55a0bc0aaff0093c5886e8c184414cc Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 7 Jul 2021 15:56:39 +0200 Subject: [PATCH] impl-link: use loopvisited variable for loop checking Don't reuse the visited variable for checking feedback loops because the scheduler expects it to be false on entry. Use a different variable instead. --- src/pipewire/impl-link.c | 6 +++--- src/pipewire/private.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pipewire/impl-link.c b/src/pipewire/impl-link.c index 123534134..c4b73c30f 100644 --- a/src/pipewire/impl-link.c +++ b/src/pipewire/impl-link.c @@ -935,7 +935,7 @@ static bool pw_impl_node_can_reach(struct pw_impl_node *output, struct pw_impl_n struct pw_impl_port *p; struct pw_impl_link *l; - output->visited = true; + output->loopchecked = true; if (output == input) return true; @@ -947,11 +947,11 @@ static bool pw_impl_node_can_reach(struct pw_impl_node *output, struct pw_impl_n spa_list_for_each(p, &output->output_ports, link) { spa_list_for_each(l, &p->links, output_link) - l->input->node->visited = l->feedback; + l->input->node->loopchecked = l->feedback; } spa_list_for_each(p, &output->output_ports, link) { spa_list_for_each(l, &p->links, output_link) { - if (l->input->node->visited) + if (l->input->node->loopchecked) continue; if (pw_impl_node_can_reach(l->input->node, input, hop+1)) return true; diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 915dcb449..9aa876200 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -672,6 +672,7 @@ struct pw_impl_node { unsigned int want_driver:1; /**< this node wants to be assigned to a driver */ unsigned int passive:1; /**< driver graph only has passive links */ unsigned int freewheel:1; /**< if this is the freewheel driver */ + unsigned int loopchecked:1; /**< for feedback loop checking */ uint32_t port_user_data_size; /**< extra size for port user data */