From 12ca6f16d2f801a8a8b567875dc87d849966b869 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 25 May 2026 13:15:12 +0200 Subject: [PATCH] impl-node: use port_update_state() in suspend_node Instead of just setting the port state directly, go through the port_update_state() function. This will make suspend_node() also emit the port state change event to the links. This then causes the link to reset to INIT, which cancels pending complete_ready work items and prevents them from changing the port to READY without a valid format. One possible situation where this could happen is when a suspend happens while the port was waiting for a set_param(Format) reply from the client-node. See #3547 --- src/pipewire/impl-node.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 91534bd83..8bb477345 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -558,16 +558,18 @@ static int suspend_node(struct pw_impl_node *this) if ((res = pw_impl_port_set_param(p, SPA_PARAM_Format, 0, NULL)) < 0) pw_log_warn("%p: error unset format input: %s", this, spa_strerror(res)); - /* force CONFIGURE in case of async */ - p->state = PW_IMPL_PORT_STATE_CONFIGURE; + /* force CONFIGURE in case of async, use update_state to + * notify links so they can cancel pending work */ + pw_impl_port_update_state(p, PW_IMPL_PORT_STATE_CONFIGURE, 0, NULL); } spa_list_for_each(p, &this->output_ports, link) { if ((res = pw_impl_port_set_param(p, SPA_PARAM_Format, 0, NULL)) < 0) pw_log_warn("%p: error unset format output: %s", this, spa_strerror(res)); - /* force CONFIGURE in case of async */ - p->state = PW_IMPL_PORT_STATE_CONFIGURE; + /* force CONFIGURE in case of async, use update_state to + * notify links so they can cancel pending work */ + pw_impl_port_update_state(p, PW_IMPL_PORT_STATE_CONFIGURE, 0, NULL); } node_update_state(this, PW_NODE_STATE_SUSPENDED, 0, NULL);