Repository navigation
egocap: drop the capture_unix_us timestamp basis - #1525
Conversation
No publisher stamps it any more: the camera bridge publishes the frame-ready time or the chrony-qualified capture time, and the Jetson sender's choices are monotonic_us, capture_monotonic_us and processing_unix_us. Streams files and the emulator no longer accept it, and wire value 3 is no longer assigned. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@NVdejung @NVshawnhwang this removes the |
NVdejung
left a comment
There was a problem hiding this comment.
🤖 Automated first-pass review (Claude, for Dejun) — I'll follow up personally where needed.
Summary — This PR removes the capture_unix_us timestamp basis from egocap: the streams-file loader, LiveKitTimestampBasis value 3, the Orin emulator's --timestamp-basis, the docs and the tests. The removal is complete. Nothing in the repository (Python, frontend, docs, example configs) still names the basis, and recording is unaffected because it already allowlisted only the two monotonic bases (backend/egocap_web/livekit_recording.py:54). I found no blockers. The main follow-up is to reserve value 3 so it is never reused. I read the code but did not run the tests.
Must fix
None found.
Suggestions (paths are under examples/egocap/)
- Reserve wire value 3 and pin it with a test.
capture_server/README.md:576already lists retired values ("unused StopReason values 2, 3 and 5 are reserved"). AddLiveKitTimestampBasis3 to that sentence. A one-line "3 was SENSOR_CAPTURE_UNIX_US, do not reuse" comment in the enum atcapture_server/capture_server/protocol.py:216would also help. Also add{"timestamp_basis": 3}next to 0 and 5 intest_livekit_camera_stream_rejects_bad_fields(tests/capture_server/test_livekit_streams.py:127). As changed, the tests would still pass if 3 were given a new meaning. Today, a peer that still sends 3 gets its wholeSessionInitrejected (protocol.py:1870), which is safe. If 3 is reassigned later, an older capture server's stream would be misread without any error. - Emulator help text that was not updated. In
tools/livekit_orin_emulator.py:102, the--clock-offset-mshelp still says it "applies to the Unix bases", but onlyprocessing_unix_usis left. The matching test was renamed to..._the_unix_basis_...; the help was not. At:115,--pipeline-delay-msnow only shiftscapture_monotonic_us. Naming that basis in the help would stop people setting the flag with the defaultmonotonic_usand seeing no effect. - Test leftovers.
tests/backend/test_livekit_recording.py:415and:854keep abasis = PROCESSINGlocal from the old parametrization; inline it.test_non_monotonic_basis_is_still_refused(:853) now checks the same thing astest_unrecordable_reason_names_a_stream_that_is_not_monotonic(:840) and could be dropped. - Check before merging. A streams file that still declares
capture_unix_usnow stops the whole capture server at startup with exit code 2 (capture_server/capture_server/server.py:2275), not just that stream. The description says nothing publishes this basis any more. Still, confirm that no deployed station's streams file names it, for example one written for the bridge before#1519.
Conflicts
- With
main: the PR is 0 commits behind and there are no 3-way conflicts, so no rebase is needed. GitHub's "blocked" state comes from branch protection, not a conflict. - With open PRs:
#1520(same author) sharestests/backend/test_livekit_recording_source.py. It targets another feature branch rather thanmain, so textual conflicts were not computed. This PR deletes theUNIX_CAPTUREconstant and the stream-22 line intest_only_monotonic_streams_with_full_geometry_are_recordable. Whichever of the two lands second should rebase and check that it adds noUNIX_CAPTUREorSENSOR_CAPTURE_UNIX_USuse; once the member is gone, either would fail when the test runs.
Change-by-change (9 files)
| File / area | What changed | Makes sense? |
|---|---|---|
capture_server/capture_server/protocol.py |
Drops SENSOR_CAPTURE_UNIX_US = 3 and its comment; the class docstring (recording accepts 1 and 4) is still accurate |
✅ (value 3 should be reserved, see suggestions) |
capture_server/capture_server/livekit_streams.py |
Drops capture_unix_us from _BASES, so the loader's existing "must be one of" error now covers it |
✅ intended; such a file now stops the server at startup |
capture_server/README.md |
Enum table, timestamp_basis field row, YAML comment and name-to-value sentence drop 3; now says "2 is preview only" |
✅ (the reserved-values sentence at L576 was not updated) |
LIVEKIT_PREVIEW.md |
Emulator --timestamp-basis values updated |
✅ nit: the emulator and the Orin sender now take the same three values, so the two sentences could be merged |
tools/livekit_orin_emulator.py |
_CAPTURE_BASES is now capture_monotonic_us only; --timestamp-basis choices and help updated |
--clock-offset-ms and --pipeline-delay-ms was not updated |
tests/capture_server/test_livekit_streams.py |
Wire-stability, JSON round-trip and loader-accept cases drop 3; capture_unix_us is added to the loader's rejected names |
✅ (but the wire value 3 is not in the rejected list) |
tests/tools/test_livekit_orin_emulator.py |
capture_unix_us cases removed; drift test moved to processing_unix_us (same numbers, since that model has no offset or delay); offset test renamed |
✅ the delay-at-capture path is still asserted through monotonic_us and capture_monotonic_us |
tests/backend/test_livekit_recording.py |
UNIX_CAPTURE removed; two parametrized tests reduced to PROCESSING |
|
tests/backend/test_livekit_recording_source.py |
UNIX_CAPTURE and its stream 22 removed from the recordable-filter test |
✅ |
| Unchanged consumers (checked) | backend/egocap_web/livekit_recording.py allowlists only 1 and 4. frontend/src/captureProtocol.ts:364 reads the basis as a bounded integer and defines constants only for 1 and 4 |
✅ the frontend vitest that was not run is not affected |
Reviewed at e767543 · 9 files · 2026-11-13 15:45 PST
Automated reviewThe PR removes the capture_unix_us basis and the SENSOR_CAPTURE_UNIX_US enum member from the streams loader, protocol, emulator, docs and tests. A repo-wide case-insensitive grep finds no leftover references except the test asserting the value is now rejected. The docs, the emulator's _CAPTURE_BASES and the README tables are consistent. I found no correctness problems. No issues found. ✅ Nothing blocking left from my side — auto-review of this one is now finished. 🤖 Sent by Shawn's Claude — automatic reply. Shawn hasn't reviewed this personally yet; treat it as a first pass. |
Summary
capture_unix_ustimestamp basis from egocap: the streams-file loader, the Orin emulator's--timestamp-basischoices, theLiveKitTimestampBasisenum member (wire value 3 is no longer assigned), the docs and the tests that exercised it.processing_unix_usstays: the Jetson sender still publishes it.Why
No publisher stamps
capture_unix_usany more. The camera bridge now publishes either the frame-ready time or the chrony-qualified capture time, both on the publisher's monotonic clock (see the bridge PR that removes it), and the Jetson sender's choices aremonotonic_us,capture_monotonic_usandprocessing_unix_us. The basis was never recordable, since no Unix-clock mapping is part of the synchronization path; keeping it only let a streams file declare a basis nothing produces.A streams file that names
capture_unix_usis now rejected with the existing "timestamp_basis must be one of ..." error.Validation
examples/egocap/tests(the LiveKit streams loader, emulator, recording and receiver tests, plus every other test that mentionstimestamp_basis).ruffand the repository pre-commit hooks pass on the changed files.captureProtocolvitest (no node dependencies installed here). The frontend defines only the monotonic basis constants, so it is not changed.🤖 Generated with Claude Code
Summary by CodeRabbit