From e86a770349224ce5808fd1dc466e0cedd8dfc433 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 13 Jul 2023 12:18:11 +0200 Subject: [PATCH] private: we only ever decrement activation with 1 --- pipewire-jack/src/pipewire-jack.c | 2 +- src/pipewire/impl-node.c | 4 ++-- src/pipewire/private.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c index 842f3aa71..f5aa3da06 100644 --- a/pipewire-jack/src/pipewire-jack.c +++ b/pipewire-jack/src/pipewire-jack.c @@ -1737,7 +1737,7 @@ static inline void signal_sync(struct client *c) pw_log_trace_fp("%p: link %p %p %d/%d", c, l, state, state->pending, state->required); - if (pw_node_activation_state_dec(state, 1)) { + if (pw_node_activation_state_dec(state)) { l->activation->status = PW_NODE_ACTIVATION_TRIGGERED; l->activation->signal_time = nsec; diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index ae10cf97c..89bea92af 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1158,7 +1158,7 @@ static inline int trigger_targets(struct pw_impl_node *this, int status, uint64_ pw_log_trace_fp("%p: (%s-%u) state:%p pending:%d/%d", t->node, t->name, t->id, state, state->pending, state->required); - if (pw_node_activation_state_dec(state, 1)) { + if (pw_node_activation_state_dec(state)) { a->status = PW_NODE_ACTIVATION_TRIGGERED; a->signal_time = nsec; if (SPA_UNLIKELY(spa_system_eventfd_write(t->system, t->fd, 1) < 0)) @@ -1263,7 +1263,7 @@ int pw_impl_node_trigger(struct pw_impl_node *node) struct pw_node_activation *a = node->rt.target.activation; struct pw_node_activation_state *state = &a->state[0]; - if (pw_node_activation_state_dec(state, 1)) { + if (pw_node_activation_state_dec(state)) { uint64_t nsec = get_time_ns(node->data_system); a->status = PW_NODE_ACTIVATION_TRIGGERED; a->signal_time = nsec; diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 830534b7c..8b260085b 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -549,7 +549,7 @@ static inline void pw_node_activation_state_reset(struct pw_node_activation_stat state->pending = state->required; } -#define pw_node_activation_state_dec(s,c) (__atomic_sub_fetch(&(s)->pending, c, __ATOMIC_SEQ_CST) == 0) +#define pw_node_activation_state_dec(s) (ATOMIC_DEC(s->pending) == 0) struct pw_node_target { struct spa_list link;