fix(udpscope): bound accumulated-burst chaining so packet loss cannot displace the trace

Forward-chaining each accumulated burst onto the previous one suppresses
arrival jitter, but an unchecked chain never recovers: one lost datagram, or a
declared sampling rate that differs from the producer's real one, dates every
later sample early for the rest of the run. The chain is now a prediction,
compared each packet against the arrival anchor and abandoned beyond
kBurstResyncThresholdS, which bounds the error instead of accumulating it.

Plan amended so the hrt-fit fallback (unusable here: the fit needs 32 packets
and is itself corrupted by bursty arrivals) cannot come back.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino Ferrari
2026-08-27 20:08:05 +02:00
co-authored by Claude Opus 4.6
parent 5a8479cda9
commit 892e3eae28
4 changed files with 153 additions and 22 deletions
+5 -2
View File
@@ -54,8 +54,11 @@ private:
bool lastAccValid = false;
uint32_t prevAccCount = 0;
/** For accumulated scalars with a declared sampling rate: end timestamp
* of the most recently emitted burst, used as a forward-chain anchor
* that is immune to arrival-time jitter. */
* of the most recently emitted burst. The next burst is PREDICTED to
* start one sample period after it — immune to arrival-time jitter
* but the prediction is discarded when arrival time disagrees with it
* by more than a delivery backlog can explain, so packet loss cannot
* displace the trace permanently. */
double lastEmittedEnd = 0.0;
bool lastEmittedValid = false;
};