From 0633be3c123363d06fa5bb95ea851ace67faa6de Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 4 Apr 2024 20:47:43 +0200 Subject: [PATCH] node: add a cycle counter to the position So that we can count the number of times the graph is scheduled. --- spa/include/spa/node/io.h | 2 +- src/pipewire/impl-node.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spa/include/spa/node/io.h b/spa/include/spa/node/io.h index bde1b6202..35661e0b7 100644 --- a/spa/include/spa/node/io.h +++ b/spa/include/spa/node/io.h @@ -148,7 +148,7 @@ struct spa_io_clock { uint64_t target_duration; /**< Target duration of next cycle */ uint32_t target_seq; /**< Seq counter. must be equal at start and * end of read and lower bit must be 0 */ - uint32_t padding; + uint32_t cycle; /**< incremented each time the graph is started */ uint64_t xrun; /**< Estimated accumulated xrun duration */ }; diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 7584383c2..926dd8bbc 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1907,11 +1907,12 @@ again: } } - a->status = PW_NODE_ACTIVATION_TRIGGERED; a->prev_signal_time = a->signal_time; - a->signal_time = nsec; node->driver_start = nsec; + a->status = PW_NODE_ACTIVATION_TRIGGERED; + a->signal_time = nsec; + a->sync_timeout = SPA_MIN(min_timeout, DEFAULT_SYNC_TIMEOUT); if (SPA_UNLIKELY(reposition_target != NULL)) { @@ -1925,6 +1926,7 @@ again: update_position(node, all_ready, nsec); pw_impl_node_rt_emit_start(node); + a->position.clock.cycle++; } /* this should not happen, driver nodes that are not currently driving * should not emit the ready callback */