From cc2c86a55b27d5c73f291a22dd24744ae23b94c7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 8 Aug 2024 15:15:39 +0200 Subject: [PATCH] impl-node: always INACTIVATE a node when stopping Set the node state INACTIVE on the client and server side in all cases when stopping to ensure nothing tries to schedule the node anymore. --- pipewire-jack/src/pipewire-jack.c | 5 +++-- src/pipewire/impl-node.c | 17 ++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 9537b8e3b..50aa349de 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -2400,13 +2400,14 @@ static int do_unprepare_client(struct spa_loop *loop, bool async, uint32_t seq, struct link *l; pw_log_debug("%p prepared:%d ", c, c->rt.prepared); - if (!c->rt.prepared) - return 0; old_state = SPA_ATOMIC_XCHG(c->activation->status, PW_NODE_ACTIVATION_INACTIVE); if (old_state != PW_NODE_ACTIVATION_FINISHED) trigger = get_time_ns(c->l->system); + if (!c->rt.prepared) + return 0; + spa_list_for_each(l, &c->rt.target_links, target_link) { if (!c->async && trigger != 0) l->trigger(l, trigger); diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 09c6c223a..1e28065ab 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -222,15 +222,14 @@ do_node_unprepare(struct spa_loop *loop, bool async, uint32_t seq, pw_log_trace("%p: unprepare %d remote:%d exported:%d", this, this->rt.prepared, this->remote, this->exported); - if (!this->exported) { - /* We mark ourself as finished now, this will avoid going further into the process loop - * in case our fd was ready (removing ourselfs from the loop should avoid that as well). - * If we were supposed to be scheduled make sure we continue the graph for the peers we - * were supposed to trigger */ - old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, PW_NODE_ACTIVATION_INACTIVE); - if (PW_NODE_ACTIVATION_PENDING_TRIGGER(old_state)) - trigger = get_time_ns(this->rt.target.system); - } + /* We mark ourself as finished now, this will avoid going further into the process loop + * in case our fd was ready (removing ourselfs from the loop should avoid that as well). + * If we were supposed to be scheduled make sure we continue the graph for the peers we + * were supposed to trigger */ + old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, PW_NODE_ACTIVATION_INACTIVE); + if (PW_NODE_ACTIVATION_PENDING_TRIGGER(old_state)) + trigger = get_time_ns(this->rt.target.system); + if (!this->rt.prepared) return 0;