From 0a8ddba3e924a67e5e8b17c98014dc28e43d2534 Mon Sep 17 00:00:00 2001 From: Martin Geier Date: Wed, 17 Dec 2025 14:26:57 +0100 Subject: [PATCH] node-driver: report discontinuity flag when resyncing position module-rtp-sink is sending data timestampted with clock provided from a driver. When driver jumps (for example due ptp master change) rtp sink has to jumps too. Rtp sink is checking for difference between expected and actual position and is big enough the jump is done. As resync value in driver is not equal to diff between positions, sink could ends with not precise timestamps up to 1 quantum. Emit discont flag when driver jumps, so sink can be reinitialized without its own heuristic. --- spa/plugins/support/node-driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/support/node-driver.c b/spa/plugins/support/node-driver.c index 5180b113a..6cd6a403a 100644 --- a/spa/plugins/support/node-driver.c +++ b/spa/plugins/support/node-driver.c @@ -363,6 +363,7 @@ static void on_timeout(struct spa_source *source) double corr = 1.0, err = 0.0, abs_err = 0.0; int res; bool timer_was_canceled = false; + bool report_discont = false; /* See set_timeout() for an explanation about timer cancelation. */ @@ -380,6 +381,7 @@ static void on_timeout(struct spa_source *source) return; } } + report_discont = timer_was_canceled; if (SPA_LIKELY(this->position)) { duration = this->position->clock.target_duration; @@ -487,6 +489,7 @@ static void on_timeout(struct spa_source *source) spa_dll_set_bw(&this->dll, SPA_DLL_BW_MAX, duration, rate); position = current_position; err = 0.0; + report_discont = true; } else { err = SPA_CLAMPD(err, -this->max_error, this->max_error); } @@ -519,7 +522,7 @@ static void on_timeout(struct spa_source *source) this->clock->next_nsec = this->next_time + nsec_offset; SPA_FLAG_UPDATE(this->clock->flags, SPA_IO_CLOCK_FLAG_DISCONT, - timer_was_canceled); + report_discont); } spa_node_call_ready(&this->callbacks,