scheduler: activate links also in make_runnable

Also make sure we unset the preparing flag when the port state
changes.
This commit is contained in:
Wim Taymans 2026-03-03 11:55:16 +01:00
parent 95e89f786a
commit a3853c2c3d
2 changed files with 21 additions and 4 deletions

View file

@ -144,7 +144,12 @@ static void make_runnable(struct pw_context *context, struct pw_impl_node *node)
spa_list_for_each(p, &node->output_ports, link) {
spa_list_for_each(l, &p->links, output_link) {
n = l->input->node;
if (!l->prepared || !n->active || l->input->passive)
pw_log_trace(" out-port %p: link %p passive:%d prepared:%d active:%d runn:%d", p,
l, l->input->passive, l->prepared, n->active, n->runnable);
if (!n->active || l->input->passive)
continue;
pw_impl_link_prepare(l);
if (!l->prepared)
continue;
if (!n->runnable)
make_runnable(context, n);
@ -153,7 +158,12 @@ static void make_runnable(struct pw_context *context, struct pw_impl_node *node)
spa_list_for_each(p, &node->input_ports, link) {
spa_list_for_each(l, &p->links, input_link) {
n = l->output->node;
if (!l->prepared || !n->active || l->output->passive)
pw_log_trace(" in-port %p: link %p passive:%d prepared:%d active:%d runn:%d", p,
l, l->output->passive, l->prepared, n->active, n->runnable);
if (!n->active || l->output->passive)
continue;
pw_impl_link_prepare(l);
if (!l->prepared)
continue;
if (!n->runnable)
make_runnable(context, n);
@ -201,6 +211,9 @@ static void check_runnable(struct pw_context *context, struct pw_impl_node *node
struct pw_impl_link *l;
struct pw_impl_node *n;
pw_log_trace("node %p: '%s' always-process:%d runnable:%u active:%d", node,
node->name, node->always_process, node->runnable, node->active);
if (node->always_process && !node->runnable)
make_runnable(context, node);
@ -209,6 +222,8 @@ static void check_runnable(struct pw_context *context, struct pw_impl_node *node
n = l->input->node;
/* the peer needs to be active and we are linked to it
* with a non-passive link */
pw_log_trace(" out-port %p: link %p passive:%d prepared:%d active:%d", p,
l, p->passive, l->prepared, n->active);
if (!n->active || p->passive)
continue;
/* explicitly prepare the link in case it was suspended */
@ -222,6 +237,8 @@ static void check_runnable(struct pw_context *context, struct pw_impl_node *node
spa_list_for_each(p, &node->input_ports, link) {
spa_list_for_each(l, &p->links, input_link) {
n = l->output->node;
pw_log_trace(" in-port %p: link %p passive:%d prepared:%d active:%d", p,
l, p->passive, l->prepared, n->active);
if (!n->active || p->passive)
continue;
pw_impl_link_prepare(l);

View file

@ -1051,13 +1051,13 @@ static void port_state_changed(struct pw_impl_link *this, struct pw_impl_port *p
case PW_IMPL_PORT_STATE_INIT:
case PW_IMPL_PORT_STATE_CONFIGURE:
if (this->prepared || state < old) {
this->prepared = false;
this->prepared = this->preparing = false;
link_update_state(this, PW_LINK_STATE_INIT, 0, NULL);
}
break;
case PW_IMPL_PORT_STATE_READY:
if (this->prepared || state < old) {
this->prepared = false;
this->prepared = this->preparing = false;
link_update_state(this, PW_LINK_STATE_NEGOTIATING, 0, NULL);
}
break;