Debian Codegraph @

debian/patches/28b1cfc617d12a605a34ea9060102334cd86fe95.patch

raw
1 From 28b1cfc617d12a605a34ea9060102334cd86fe95 Mon Sep 17 00:00:00 2001
2 From: Sergio Ammirata <[email protected]>
3 Date: Fri, 26 Jun 2026 08:15:42 -0400
4 Subject: [PATCH] fix(receiver): clear stale clock-drift samples on a
5 framing-baseline reset (#218)
6 Forwarded: https://code.videolan.org/rist/librist/-/work_items/218
7
8 When an Advanced flow upgrades from Main to Advanced wire framing
9 mid-stream, the two framings carry source_time in different timestamp
10 domains, so the switch resets the flow timing baseline. That reset
11 re-derived time_offset but left the clock-drift sample buffer full of
12 stale Main-domain samples. The next median recalculation then jumped
13 the offset by several seconds and released the whole receiver buffer at
14 once, overflowing the data-out fifo. Because test_send_receive treats
15 any ERROR-level log as fatal at 0% loss, the single "Rist data out fifo
16 queue overflow" line failed the advanced+unicast+client tests, most
17 reproducibly on slower build hosts.
18
19 Clear the drift samples on the baseline reset, matching the existing
20 clock-wrap reset path.
21
22 Thanks to Florian Ernst for the detailed report and build logs.
23 ---
24 src/rist-common.c | 8 ++++++++
25 1 files changed, 8 insertions(+)
26
27 diff --git a/src/rist-common.c b/src/rist-common.c
28 index 200598db..7965231d 100755
29 --- a/src/rist-common.c
30 +++ b/src/rist-common.c
31 @@ -747,6 +747,14 @@ static int receiver_enqueue(struct rist_peer *peer, uint64_t source_time, uint64
32 f->last_packet_ts = packet_time;
33 f->time_offset_changed_ts = 0;
34 f->time_offset_old = f->time_offset;
35 + /* Discard clock-drift samples gathered against the previous
36 + * baseline. A flow-id change or a Main<->Advanced wire-framing
37 + * switch (the two framings carry source_time in different
38 + * timestamp domains) lands here with stale samples still queued;
39 + * blending them into the median yields a bogus multi-second
40 + * offset correction that releases the whole buffer at once and
41 + * overflows the data-out fifo. Matches the clock-wrap reset. */
42 + f->offset_recalc_sample_count = 0;
43
44 receiver_insert_queue_packet(f, peer, idx_initial, buf, len, seq, source_time, src_port, dst_port, packet_time);
45 atomic_store_explicit(&f->receiver_queue_output_idx, idx_initial, memory_order_release);
46 --
47 GitLab
48