Skip to content

[CameraInterface] Add camera_endpoint: serve a publisher's groups to readers - #1527

Closed
farbod-nv wants to merge 2 commits into
fm/camera_capture_m0_wirefrom
fm/camera_capture_m0_endpoint
Closed

farbod-nv wants to merge 2 commits into
fm/camera_capture_m0_wirefrom
fm/camera_capture_m0_endpoint

Conversation

@farbod-nv

@farbod-nv farbod-nv commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fifth pull request of the camera interface, stacked on #1526 (camera_wire), whose branch is this one's base.

It adds camera_endpoint: the camera plugin's side of the conversation with readers. Endpoint puts a camera_core Publisher on a socket (camera_ipc) and speaks the messages of camera_wire. It tells each reader what is published; when a reader subscribes it sends the group's pool descriptors and from then on the group's frame events.

Endpoint endpoint(publisher, socket_path);
endpoint.set_group_memory(head, { left.descriptor(), right.descriptor() });
endpoint.start();
  • Nothing sits between publish and the socket. A frame event is encoded and sent on the thread that publishes, inside Publisher::publish, with a send that does not block. There is no queue and no hand-over to another thread on that path.
  • One thread of its own handles the rest: accepting readers, the handshake, subscriptions and releases. It sleeps in poll until a reader sends something.
  • A reader that goes away returns what it held. A closed connection ends the subscription and gives every frame set the reader held back to the pool, whether the reader exited, crashed or was killed.
  • A reader is untrusted. Bytes that are not a message, a message only a plugin sends, or a subscription before the handshake get that reader dropped; the others are not affected. A reader with another protocol version is told so and refused.
  • A stopped endpoint gives up its path. stop() closes the listener, so a reader that tries to connect afterwards is refused at once instead of waiting in a queue nobody serves; start() takes the path again.
  • Refusals carry the reason. An unknown group, a subscription that does not fit the pool (with the numbers), or a second subscription on one connection are answered with a message, and the connection stays usable.
  • It is the first camera module that logs, through isaaccapture::Logger as isaaccapture.camera_endpoint.Endpoint: readers arriving, subscribing, being refused and leaving. Nothing is logged per frame.

The reader library that talks to it comes next; the tests here play the reader's part with the socket and the codec directly.

Type of change

  • New feature (non-breaking change which adds functionality)

Testing

  • tests/cpp/core/camera_endpoint/test_endpoint.cpp (Catch2, 9 cases, tagged unit): a reader is told what is published; a reader with another protocol version is refused and its connection closed; a subscriber maps the pools from the descriptors it is sent and reads the pixels of each frame set, a held frame set is not rewritten, and the release brings the newest one with the number skipped; subscriptions that cannot be served are refused with a reason and the connection stays usable; a reader that disappears while holding frame sets gives them back; readers that break the protocol are dropped and a well-behaved one keeps receiving; a reader that never releases does not slow another; stopping closes every reader and the endpoint can serve again; a group needs its memory named before readers can subscribe. Run with ctest -L camera_endpoint.
  • 150 repeated runs without a failure. All camera tests also pass under AddressSanitizer with UBSan and under ThreadSanitizer (the endpoint tests 20 times under ThreadSanitizer, no reports).
  • Built through the repository's own build with the project warning set promoted to errors.
  • Ubuntu 22.04 x86_64, GCC 11.4, Linux 6.8.
  • clang-format-14 reports no changes; SKIP=check-copyright-year pre-commit run --all-files passes.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the linter and formatter with SKIP=check-copyright-year pre-commit run --all-files
  • I have made corresponding changes to the documentation (a README in the module; user documentation comes with the plugin executable)
  • I have added tests that prove my fix/feature works (or explained why not)
  • I have signed off all my commits (git commit -s) per the DCO

🤖 Generated with Claude Code

Endpoint puts a Publisher on a socket and speaks the camera_wire messages:
it tells each reader what is published, and on a subscription sends the
group's pool descriptors and from then on its frame events.

One thread accepts readers and handles the handshake, subscriptions and
releases. Frame events are not sent from it: they are encoded and sent on
the publishing thread, inside Publisher::publish, with a send that does not
block, so nothing sits between a frame set being published and its event
being on the socket.

A closed connection ends the reader's subscription and returns every frame
set it held, whether the reader exited or was killed. A reader that breaks
the protocol is dropped without affecting the others.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

stop() ended the endpoint's thread but kept the listening socket, so a
reader that connected afterwards was accepted by the kernel and then waited
for an answer nobody would send. stop() now closes the listener, which
removes the socket file and releases the path: a reader that tries to
connect is refused at once. start() takes the path again.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Farbod Motlagh <fmotlagh@nvidia.com>
@farbod-nv

Copy link
Copy Markdown
Contributor Author

Folded into #1528. The first milestone of the camera interface is now four pull requests instead of twelve: #1521, #1528, #1530 and #1534.

This branch was successfully deployed

1 active deployment
dev — 8fb524a1 Deployed Nov 14, 2026 by farbod-nv via publish-wheel #6954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants