Repository navigation
camera_streamer: add a UDP clock exchange responder to the sender - #1475
gareth-morgan-nv wants to merge 7 commits into
Conversation
Signed-off-by: Teng Wei <tengw@nvidia.com>
…LOCK_MONOTONIC
ClockResponder is a stateless, unauthenticated UDP responder that lives as long as the sender process, whether or not a
receiver is connected. A datagram of exactly 13 bytes ('Q', u32 seq, i64 t1, little-endian) is answered to its source
with 29 bytes ('R', seq, t1 echoed, t2, t3) where t2 is read as soon as the receive returns and t3 immediately before
the send, both on CLOCK_MONOTONIC; anything else is ignored. The requester matches replies to its outstanding (seq, t1)
and resets on a media session change, so the responder keeps no session state. network.clock_port (0 = off, the default)
turns it on. Tests cover the payload encoding, a loopback round trip, bursts, malformed datagrams, concurrent clients,
prompt shutdown, bind errors and the config key.
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>
|
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 68e7ed2: no additional merge-critical finding from this pass. I compiled and ran the clock_exchange test successfully. The backend-independent responder and explicit handling of network asymmetry are useful building blocks. For the combined stack, retain the requester-side checks for outstanding request, source, staleness, and session reset implemented in #1479. An offset measurement should remain distinct from a claim of exact physical capture time. I have not performed a new real-camera/network run for this review. |
…stablish A requester should check the reply's source, the estimate's age and the session id as well as the outstanding request, and an offset between two clocks is not a claim about when a sensor exposed a frame. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Gareth Morgan <gmorgan@nvidia.com>
|
🤖 Agent-generated (Claude Code · claude-sonnet-5-5) Thanks for the review and for compiling and running the clock-exchange test. This PR is going to be closed, so no further changes will be made here. I had already added the clock-exchange caveats from your review to this branch's README (ca8c6cd): the requester should check the reply's source, the estimate's age and the session id, and an offset is not a claim of exact physical capture time. |
0e25e37 to
fab7780
Compare
Summary
Lets the sender answer a four-timestamp clock exchange over UDP on its
CLOCK_MONOTONIC, so a receiving host can measure the offset between its clock and the sender's. It is independent of the camera backend and of the AVS1 timing record, and off by default.What changed
ClockExchange: the 13-byte request (Q,u32 seq,i64 t1) and 29-byte reply (R,seq,t1echoed,t2,t3), little-endian;t2andt3are the sender'sCLOCK_MONOTONICin nanoseconds.ClockResponder: a stateless UDP responder started with the sender and kept for the life of the process, whether or not a receiver is connected.t2is read as soon as the receive returns andt3just before the reply is sent. Anything that is not exactly one request is ignored.network.clock_port(0 = off, the default) sets the port. The README documents the exchange and how a requester computes round-trip delay and offset from its ownt1andt4.Validation
clang-format-14andpre-commitclean on the changed files.clock_exchangeandclock_responder, plus theconfigkey, built and run by hand on a PC.Known limitations / follow-ups
session_idchanges or the connection is re-established; the responder keeps no session state.Test plan
🤖 Generated with Claude Code