impl-node: correctly synchronize suspend state with remote node

Previously, if a remote node was set to running and immediately reverted
to suspended state, the remote node stayed in running state. This occurred
because suspend_node sent suspend command only when the locally cached
state was "idle" or "running."

Modified to send suspend to a node whenever its pending state is not
"suspended," ensuring the command is sent during state transitions.

Fixes #5026

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
This commit is contained in:
Martin Geier 2026-03-23 10:40:18 +01:00
parent 9ba0c3cfd3
commit 52b23384e0

View file

@ -528,13 +528,15 @@ static void node_update_state(struct pw_impl_node *node, enum pw_node_state stat
static int suspend_node(struct pw_impl_node *this)
{
struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this);
int res = 0;
struct pw_impl_port *p;
pw_log_debug("%p: suspend node state:%s", this,
pw_node_state_as_string(this->info.state));
if (this->info.state > 0 && this->info.state <= PW_NODE_STATE_SUSPENDED)
if (this->info.state > 0 && this->info.state < PW_NODE_STATE_SUSPENDED ||
this->info.state == PW_NODE_STATE_SUSPENDED && impl->pending_state == PW_NODE_STATE_SUSPENDED)
return 0;
spa_list_for_each(p, &this->input_ports, link) {