diff --git a/src/pipewire/context.c b/src/pipewire/context.c index f726e779e..84eca3bda 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1211,6 +1211,7 @@ again: suspend_driver(context, n); } n->current_rate = SPA_FRACTION(1, target_rate); + n->current_pending = true; current_rate = target_rate; /* we might be suspended now and the links need to be prepared again */ goto again; @@ -1242,6 +1243,7 @@ again: n->current_quantum, quantum); n->current_quantum = quantum; + n->current_pending = true; } pw_log_debug("%p: driving %p running:%d passive:%d quantum:%u '%s'", diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 212b911c6..6d7c0ccac 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -820,6 +820,7 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv if (old != node && old->driving && driver->info.state < PW_NODE_STATE_RUNNING) { driver->current_rate = old->current_rate; driver->current_quantum = old->current_quantum; + driver->current_pending = true; pw_log_info("move quantum:%"PRIu64" rate:%d (%s-%d -> %s-%d)", driver->current_quantum, driver->current_rate.denom, @@ -1592,8 +1593,11 @@ static int node_ready(void *data, int status) node->rt.target.signal(node->rt.target.data); } - node->rt.position->clock.duration = node->current_quantum; - node->rt.position->clock.rate = node->current_rate; + if (node->current_pending) { + node->rt.position->clock.duration = node->current_quantum; + node->rt.position->clock.rate = node->current_rate; + node->current_pending = false; + } sync_type = check_updates(node, &reposition_owner); owner[0] = ATOMIC_LOAD(a->segment_owner[0]); diff --git a/src/pipewire/private.h b/src/pipewire/private.h index e0d74cccb..63126261b 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -684,6 +684,7 @@ struct pw_impl_node { unsigned int lock_quantum:1; /**< don't change graph quantum */ unsigned int lock_rate:1; /**< don't change graph rate */ unsigned int transport_sync:1; /**< supports transport sync */ + unsigned int current_pending:1; /**< a quantum/rate update is pending */ uint32_t port_user_data_size; /**< extra size for port user data */