From a32e6e108c366580a08e00d616f60f299c1d9e8b Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Tue, 27 Jan 2026 21:24:43 +0100 Subject: [PATCH] Revert "module-rtp: Remove device_delay from timestamp math" This reverts commit dcdc19238be3a2dc354f28adbfb0258042640704. Reverting this because it caused big sync errors of ~62 ms in test setups. Further discussions about this can be found here: https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/2666 Followup commits modify the device delay application (by scaling it), which is another reason why this needs to be reverted. --- src/modules/module-rtp/audio.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/modules/module-rtp/audio.c b/src/modules/module-rtp/audio.c index 13873f29c..0f2936b24 100644 --- a/src/modules/module-rtp/audio.c +++ b/src/modules/module-rtp/audio.c @@ -98,12 +98,9 @@ static void rtp_audio_process_playback(void *data) * pace of the driver. */ if (impl->io_position) { - /* Use the clock position directly as the read index. - * Do NOT add device_delay here - the sink's DLL handles - * matching its hardware clock to the driver pace. Adding - * device_delay would create a feedback loop since rate - * adjustments affect both ringbuffer and device buffer. */ - timestamp = impl->io_position->clock.position; + /* Shift clock position by stream delay to compensate + * for processing and output delay. */ + timestamp = impl->io_position->clock.position + device_delay; spa_ringbuffer_read_update(&impl->ring, timestamp); } else { /* In the unlikely case that no spa_io_position pointer