From 1ef6db7d549200ad798435b586ebffebbfd381d4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 16 Aug 2024 22:44:53 +0200 Subject: [PATCH] impl-node: only increment pending when not async Place the async state of the node in its activation. Don't increment the pending state of the driver when an async node is found because the async nodes will not trigger the driver when they complete. See !2104 --- src/pipewire/impl-node.c | 4 +++- src/pipewire/private.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index d32a3f5d1..5e17a2098 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1206,6 +1206,7 @@ static void check_properties(struct pw_impl_node *node) if (async != node->async) { pw_log_info("%p: async %d -> %d", node, node->async, async); node->async = async; + SPA_FLAG_UPDATE(node->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_ASYNC, async); } if ((str = pw_properties_get(node->properties, PW_KEY_MEDIA_CLASS)) != NULL && @@ -2106,7 +2107,8 @@ retry_status: if (SPA_UNLIKELY(!SPA_ATOMIC_CAS(ta->status, old_status, PW_NODE_ACTIVATION_NOT_TRIGGERED))) goto retry_status; - pending++; + if (!SPA_FLAG_IS_SET(ta->flags, PW_NODE_ACTIVATION_FLAG_ASYNC)) + pending++; if (old_status == PW_NODE_ACTIVATION_TRIGGERED || old_status == PW_NODE_ACTIVATION_AWAKE) { diff --git a/src/pipewire/private.h b/src/pipewire/private.h index bd4c14250..bb181b617 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -618,6 +618,7 @@ struct pw_node_activation { uint32_t driver_id; /* the current node driver id */ #define PW_NODE_ACTIVATION_FLAG_NONE 0 #define PW_NODE_ACTIVATION_FLAG_PROFILER (1<<0) /* the profiler is running */ +#define PW_NODE_ACTIVATION_FLAG_ASYNC (1<<1) /* the node is async */ uint32_t flags; /* extra flags */ struct spa_io_position position; /* contains current position and segment info. * extra info is updated by nodes that have set