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.
This commit is contained in:
Wim Taymans 2021-07-07 15:56:39 +02:00
parent afb7090ba0
commit 33f90abfb5
2 changed files with 4 additions and 3 deletions

View file

@ -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_port *p;
struct pw_impl_link *l; struct pw_impl_link *l;
output->visited = true; output->loopchecked = true;
if (output == input) if (output == input)
return true; 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(p, &output->output_ports, link) {
spa_list_for_each(l, &p->links, output_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(p, &output->output_ports, link) {
spa_list_for_each(l, &p->links, output_link) { spa_list_for_each(l, &p->links, output_link) {
if (l->input->node->visited) if (l->input->node->loopchecked)
continue; continue;
if (pw_impl_node_can_reach(l->input->node, input, hop+1)) if (pw_impl_node_can_reach(l->input->node, input, hop+1))
return true; return true;

View file

@ -672,6 +672,7 @@ struct pw_impl_node {
unsigned int want_driver:1; /**< this node wants to be assigned to a driver */ 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 passive:1; /**< driver graph only has passive links */
unsigned int freewheel:1; /**< if this is the freewheel driver */ 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 */ uint32_t port_user_data_size; /**< extra size for port user data */