fix: batch_ is now learned in both stream and relative-time modes so hole reservation fires in stream mode.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
5915fc8421
commit
6830b97c02
1 file changed
+12
-5
+12
-5
@@ -143,18 +143,19 @@ std::uint32_t Acquisition::build_stamps(const udps_frame_t* frame, int time_sign
|
|||||||
stamps_.assign(n, 0.0);
|
stamps_.assign(n, 0.0);
|
||||||
abs_stamps_.assign(n, 0.0);
|
abs_stamps_.assign(n, 0.0);
|
||||||
|
|
||||||
// Relative mode: the stamp is a pure function of position and the *declared* rate. Nothing
|
// Samples per packet, needed in both modes: relative stamping must advance `slot_base_`
|
||||||
// below this block runs -- not the arrival-cadence override, not the degeneracy guard, not
|
// past the reserved hole before placing this frame's own stamps, and `on_data` must size
|
||||||
// the glitch bridge, not the monotonic clamp's reason for existing -- because a position
|
// the hole before calling this function -- both operations require knowing how many samples
|
||||||
// cannot jitter, cannot fail to advance and cannot jump.
|
// a missing packet represents, which is only knowable from the first frame that arrives.
|
||||||
if (cfg_.relative_time) {
|
|
||||||
if (batch_ == 0) {
|
if (batch_ == 0) {
|
||||||
batch_ = n;
|
batch_ = n;
|
||||||
|
if (cfg_.relative_time) {
|
||||||
std::fprintf(stderr,
|
std::fprintf(stderr,
|
||||||
"[udpscope] relative time: batch=%u samples/packet, rate=%.6g S/s declared\n",
|
"[udpscope] relative time: batch=%u samples/packet, rate=%.6g S/s declared\n",
|
||||||
batch_, model_.partition().base_dt > 0.0 ? 1.0 / model_.partition().base_dt
|
batch_, model_.partition().base_dt > 0.0 ? 1.0 / model_.partition().base_dt
|
||||||
: 0.0);
|
: 0.0);
|
||||||
std::fflush(stderr);
|
std::fflush(stderr);
|
||||||
|
}
|
||||||
} else if (n != batch_) {
|
} else if (n != batch_) {
|
||||||
// A frame whose length disagrees with the first one is an inconsistency in the
|
// A frame whose length disagrees with the first one is an inconsistency in the
|
||||||
// producer, not a loss: the counter still names one packet. Warn once and keep the
|
// producer, not a loss: the counter still names one packet. Warn once and keep the
|
||||||
@@ -169,6 +170,12 @@ std::uint32_t Acquisition::build_stamps(const udps_frame_t* frame, int time_sign
|
|||||||
std::fflush(stderr);
|
std::fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Relative mode: the stamp is a pure function of position and the *declared* rate. Nothing
|
||||||
|
// below this block runs -- not the arrival-cadence override, not the degeneracy guard, not
|
||||||
|
// the glitch bridge, not the monotonic clamp's reason for existing -- because a position
|
||||||
|
// cannot jitter, cannot fail to advance and cannot jump.
|
||||||
|
if (cfg_.relative_time) {
|
||||||
double dt = model_.partition().base_dt;
|
double dt = model_.partition().base_dt;
|
||||||
if (!(dt > 0.0)) dt = 1.0e-3;
|
if (!(dt > 0.0)) dt = 1.0e-3;
|
||||||
// The reserved hole for the missing packets advances `slot_base_` so this frame's
|
// The reserved hole for the missing packets advances `slot_base_` so this frame's
|
||||||
|
|||||||
Reference in new issue
Block a user