Repository navigation
camera_livekit_bridge: qualify capture times against chrony - #1519
gareth-morgan-nv wants to merge 10 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Review of 7c46eea — keeping chrony polling off the frame path and preserving preview when timing is unqualified are good fits for this bridge. One correctness issue remains in A detected PC wall-clock step invalidates more than the single frame that detects it. The next call sees I compiled the adapter and timesync sources using the PR's fake clock/chrony fixtures. Starting healthy, I kept the sender timestamp fixed (80 ms old), stepped only PC realtime backward 20 ms, and called qualify twice without polling again. Result: Please invalidate pre-step evidence and keep timestamps unqualified until post-step synchronization evidence supports the budget. Also verify the generation change reaches the take-validity logic: recording it in worker stats alone cannot ensure an active take notices a discontinuity. Add a regression where the sender clock does not step with the PC and recovery requires new evidence. Video can continue without timestamps throughout. Validation: synthetic C++ reproduction; no live clock or camera settings were changed. |
|
🤖 Agent-generated (Claude Code · claude-sonnet-5-5) Thanks, reproduced by reading the code:
On whether a take notices: I did not add the generation to the published frame, because the recorded data and its per-frame metadata must not change. The mechanism is the existing one. The frame that reveals the step and every frame until fresh evidence arrives carry no timestamp, and a take in progress ends on the first of them with the missing-timestamp fault. After that a new take pins the new generation. If a step lands between two polls, the step is still detected by the next frame's local-clock sample, which is what sets the floor. A regression with the sender timestamp not moving with the PC clock (healthy, step PC back 20 ms, qualify twice with no poll between, then poll and recover) is being added to |
5e4cfbb to
17ff72a
Compare
e6a719b to
f305152
Compare
|
🤖 Agent-generated (Claude Code · claude-sonnet-5-5) Follow-up on the clock-step finding (pushed 621a31a, on top of the earlier 887a810 rebased as part of the stack rebase). My earlier reply said a take would notice a step through the one unstamped frame. A review of that pointed out it depends on that frame surviving the media path, and the recorder does not treat a lost frame as a fault, so I changed it. After a detected PC realtime step the adapter now gives no frame a timestamp for Tests (all with the sender timestamp not moving with the PC clock): a frame 1 s after the step with fresh post-step evidence is still refused; just before the hold ends it is refused and just after it qualifies with the post-step generation and a capture time consistent with the new clock; with a 1 ms hold the old behaviour is reachable, so the hold is configurable. The chrony_clock test passes against the #1518 module sources with my pending review fixes. Not run on hardware or with a live clock step. |
17ff72a to
b1d98d9
Compare
621a31a to
5c7154c
Compare
b1d98d9 to
a5006a9
Compare
5c7154c to
335c3f8
Compare
a5006a9 to
91bb927
Compare
335c3f8 to
9795e94
Compare
|
Rechecked Integration gate: this branch's bridge CMake adds Please label Also reconcile the timing acceptance policy with that target contract: this PR deliberately emits timestamps for Review double-checked with Codex on behalf of Farbod. |
9795e94 to
45e906c
Compare
9d829b1 to
012423b
Compare
45e906c to
be6e29f
Compare
be6e29f to
fd9c28a
Compare
3b33025 to
dcc0067
Compare
|
🤖 Agent-generated (Claude Code · claude-sonnet-5-5) Re: @farbod-nv's review — #1519 (comment) Addressed (head
This does not close the GPU slot-ownership item or claim physical timing accuracy. |
The bridge's capture_monotonic_us basis now converts the sender's wall-clock capture time with the timesync library: a background poll of this PC's and the sender's chrony, a per-frame qualification against a time budget, and a refusal that publishes the frame without a timestamp. Verdict counts are reported in the stream statistics. Frames carry no capture time unless qualified, so a recording take fails rather than recording a guessed one. The mock sender can emit the realtime timing record so the path runs without a camera. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…s the precision target A frame over the precision budget kept no capture time, so a consumer could not use it. Publish the converted instant for every usable verdict; only a conversion that cannot be vouched for publishes none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…s published A conversion that cannot be vouched for publishes no timestamp; one that passes every check but is over the precision target keeps its timestamp and is only counted differently in the statistics. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…ck step A detected PC wall-clock step refused only the frame that revealed it; the next frame reused chrony snapshots collected before the step and qualified with a capture time off by the step. Record the step time and ignore evidence read at or before it, so frames stay without a timestamp until both hosts have been read again. A take in progress then ends with the missing-timestamp fault. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
… not reused With the sender capture timestamp not moving with the PC clock: a step is refused, the next frames without a new poll are not usable, and qualification recovers only after both hosts are read again, with the capture time correct on the new clock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…lock step A take can only notice a step on this host through a frame without a timestamp or through silence, and the recorder fails a take after 5 s of silence. Refuse every frame for step_hold_ns (8 s) after a step, whatever the chrony evidence says, so a take cannot continue across the step even if the media path drops the refused frames. Evidence read before the step is still never reused. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
The bridge publishes either the frame-ready time or the chrony-qualified capture time, both on the publisher's monotonic clock. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…tion boundary Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
…tops qualifying Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
ade2abf to
abe8f87
Compare
dcc0067 to
e9a6282
Compare
Summary
Makes the bridge's
capture_monotonic_ustimestamp basis use the timesync module: it polls this PC's chrony and the camera host's, qualifies each frame's capture time against a budget, and publishes a frame without a timestamp only when the conversion cannot be vouched for. A frame over the budget keeps its timestamp. Replaces the earlier clock-exchange approach for that basis.Depends on #1518, which is this PR's base and carries
src/core/timesync(and is itself stacked on the LiveKit bridge branch, #1478). This branch builds from a clean checkout of its own tree. It should be rebased ontomainonce #1478 and #1518 have landed.What changed
chrony_clockadapter (ChronyCaptureClock): background polling of the PC's and the camera host's chrony, the per-frame qualification, and the clock generation.--chrony-sender HOST[:PORT],--chrony-sender-refid HEX,--chrony-pc-port PORT,--chronyc PATH.capture_monotonic_usrequires the first two. A frame whose conversion cannot be vouched for is published without a timestamp, so a recording take fails instead of recording a guessed time. A conversion that passes every check but is over the precision target (over_budget) is published with its timestamp and counted separately. Recording eligibility is permissive here: such a frame is recorded like aqualifiedone, because the verdict and bound are runtime diagnostics and are not carried with the video. That is this bridge's current policy, not the shared camera interface's precision admission; a consumer that must reject frames above the precision target needs the bound or a stricter publication policy. A detected wall-clock step on this host is a timing fault: for 8 s after it no frame is timestamped (longer than the recorder's 5 s silence limit, so a take cannot continue across it even if the refused frames are dropped), and chrony readings taken before it are never reused.[stats]reports the qualified count, a count per refusal reason, the last combined uncertainty and the clock generation.--timing-ext,--sensor-uncertainty-us) so the path runs without a camera.Validation
timestamp_basisandchrony_clocktests pass; CLI refusal tests pass; the bridge builds. Built from a clean checkout of this branch, which carries the module: configure, build, all six bridge tests and the five timesync tests pass.over_budget(about 6 to 11 ms against the 5 ms target) and every one was published with its capture time; a 20 s take through the unchanged recorder finished with no timing fault.Integration boundary
The
chrony_clock/adapter and the capture-time publication inbridge/stream_worker.cppare transitional: they connect the reusable timing library to the current video publication path and are intended to converge on the receiver backend's clock-mapping contract. Withcapture_monotonic_us, a mapping that cannot be vouched for publishes no timestamp and the frame-ready time is never offered in its place; a capture over the precision target keeps its timestamp.monotonic_usis a separate, declared basis.chrony_clock/and the capture-time publication inbridge/stream_worker.cppsrc/core/timesync/🤖 Generated with Claude Code