Skip to content

ariadne: live two-instance conference (clustered host + conference_live.ari) - #705

Merged
transfix merged 7 commits into
masterfrom
feat/ariadne-conference-live
Oct 19, 2026
Merged

transfix merged 7 commits into
masterfrom
feat/ariadne-conference-live

Conversation

@transfix

Copy link
Copy Markdown
Owner

Live two-instance conference 🎥🔊

Stacked on #701 (room verbs). Base auto-retargets to master once #701 (and #699) merge.

The payoff: two separate ariadne_conference processes that see and hear each other, wired entirely through the room verbs over the merged gRPC stream_bridge.

What's here

  • Clustering flags on the host (--node-id / --room / --peer-id / --state-listen / --state-peer / --media-listen): turn on a cross-process room cluster. A gRPC state_transport_grpc + state_cluster_shard replicate the room tree (serve + optionally dial a peer; backfill-on-connect converges a late joiner); a gRPC stream_transport_grpc + stream_bridge carry media; register_room_media_intrinsics is wired. The document is scoped by node-id so each participant's self-stream tokens are unique, and pump_all() each frame publishes the room-tree writes. Without --node-id the host is the single-node demo, unchanged.
  • conference_live.ari (pure DSL): each node room-joins, opens + room-publishes its own synthetic camera + a 440 Hz tone, and room-subscribes the peer's camera + audio — shown in a Me / Peer tile pair, playing the peer's audio.
  • Two small verb refinements it needed: room-publish/room-subscribe accept a bare room-id string (so a .ari can pass (state-get "conf.room") without persisting a handle across ticks), and room-publish derives the publisher's pid from the cluster shard.

Verified

Two concurrent offscreen processes:

node A: roster: A(A) B(B) | peer B.streams.camera SUBSCRIBED | peer B.streams.audio SUBSCRIBED | 2/2
node B: roster: A(A) B(B) | peer A.streams.camera SUBSCRIBED | peer A.streams.audio SUBSCRIBED | 2/2

The roster converges across the process boundary, each node pulls both of the other's streams, and the Peer tile renders the remote node's live video (screenshot in the PR).

Run it

# terminal 1 — node A (serves room-state on :7001):
ariadne_conference conference_live.ari --node-id A --peer-id B --room standup --state-listen 127.0.0.1:7001
# terminal 2 — node B (serves on :7002, dials A):
ariadne_conference conference_live.ari --node-id B --peer-id A --room standup --state-listen 127.0.0.1:7002 --state-peer 127.0.0.1:7001

Deferred

N-party roster→tiles (repeat over the roster); SFU-via-relay (server-selected, for scale); --camera in clustered mode (real webcam per participant); real speaker output (pending the relocatable-ALSA recipe fix, tasked separately); per-proxy retirement on room-leave.

@transfix
transfix changed the base branch from feat/ariadne-room-verbs to master October 19, 2026 01:31
…lice

The first room verbs for the conference app, as reusable core free functions (room_join / room_roster / room_leave) wrapped by DSL verbs (room-join / room-roster / room-leave), mirroring stream_intrinsics' document-scoped-handle pattern. Pure replicated state: participants live on the SHARED tree conf.rooms.<room>.participants.<pid>.{profile.name, presence.joined} off app.root(), so every node converges via whatever state_cluster_shard the host installs — no gRPC, no GL, no Runtime.

Trust-all self-insert (roadmap-blessed 'mesh works first; auth hardens later'): a client writes its own participant subtree and the pid is the local cluster node id. Writes use the stream.cpp touch()-before-write idiom so a fresh node's first value is not lost to the lazy distributed-observer attach. Leave is SOFT (presence.joined=0, a replicating value update) because a hard subtree delete is resurrected by any peer that still holds the participant; room_roster returns present-only. Server-mediated writes, admission/pid-allocation, roster authority and presence reaping are Phase 2 (§5d); media wiring (room-publish/-subscribe over the gRPC bridge/relay) is a later slice.

Test room_intrinsics_test (3 cases, no gRPC): local join/roster/leave; two-node join convergence (both see both, names intact); two-node soft-leave convergence (a leave replicates, both drop the leaver). Mirrors state_transport_inproc_test's two-shard + pump_all harness.
ariadne_conference now calls register_room_intrinsics(app) alongside the stream/media registrations, so a conference .ari can call (room-join/roster/leave). No demo uses them yet (a room demo needs two instances + the §5 control plane); this makes the §8 bundle complete.
The conference is a LAYER on top of the general streaming substrate — cvc::ariadne::stream and cvc::gl::ariadne stay task-neutral (streaming serves many uses, not just conferencing), so only the room/authority control plane is conference-specific. Move it into a cvc::ariadne::conference namespace + inc/cvc/ariadne/conference/ + src/cvc/ariadne/conference/, mirroring ariadne/stream/. No behaviour change; streaming is untouched.
General streaming additions (not conference-specific). stream::format()/scope() expose what a stream was opened with — the frame format and the root_path — which a consumer needs to advertise a stream or open a matching proxy for it (the stream already stores both; they just weren't exposed). own_document_stream() hands an already-open stream to a document's owning table (the same one (stream-open) fills), so a module that opens a stream itself — e.g. a pulled proxy — can make it a first-class document stream reachable by document_stream() and the (stream-info/-close/-capture/-play) verbs.
…§4b), audio proven

The conference MEDIA plane, mesh P2P over the merged gRPC stream_bridge. room-publish serve_port()s an open stream on the host's bridge and advertises its descriptor (endpoint + token + id + scope + format) under the publisher's participant subtree; room-subscribe reads a remote participant's descriptor from the REPLICATED room tree, opens a local proxy sized to the format and sharing the token (so the pull routes), and pull_from()s the publisher's endpoint. Reusable free functions (room_publish/room_subscribe) + DSL verbs (room-publish/room-subscribe), in cvc::ariadne::conference; grpc-gated (new src/cvc/ariadne/conference/room_media_intrinsics.{h,cpp}).

Test room_media_test (grpc): an f32 audio stream published on node A crosses to node B's proxy BYTE-IDENTICAL, routed entirely by the replicated descriptor — no manual endpoint wiring. State plane (room tree) on an inproc transport, media plane on a real gRPC transport on loopback, the split a two-process conference uses. Deferred: SFU-via-relay (server-selected serve/pull through stream_relay), per-proxy retirement (room-unpublish/leave teardown — the §7 gap), and the live two-instance host demo (needs host clustering plumbing).
…erive publisher pid

DSL ergonomics for the live demo: room-publish/room-subscribe now accept a bare room-id string (not only a room-join handle dict), so a .ari can pass (state-get "conf.room") without persisting the handle across program-lane ticks. And room-publish derives the publisher's pid from the default cluster shard (the publisher is always the local node) instead of reading it from the handle, so it works with a plain room-id.
…onference_live.ari)

The payoff: two ariadne_conference processes that see and hear each other. New clustering flags (--node-id/--room/--peer-id/--state-listen/--state-peer/--media-listen) turn on a cross-process room cluster — a gRPC state_transport_grpc + state_cluster_shard replicate the room tree (serve + optionally dial a peer, backfill-on-connect), a gRPC stream_transport_grpc + stream_bridge carry media, and register_room_media_intrinsics is wired. The document is scoped by node-id so each participant's self-stream tokens are unique; pump_all() each frame publishes the room-tree writes. conference_live.ari (pure DSL): each node joins, publishes its synthetic camera + a 440 Hz tone, and subscribes to the peer's, shown in a Me/Peer tile pair.

Verified end-to-end: two concurrent offscreen processes converge the roster (both see A+B) and each subscribes 2/2 to the peer's camera+audio over the bridge; the Peer tile renders the remote node's live video (screenshot). Grpc-gated; the single-node demo is unchanged without --node-id. Deferred: N-party roster->tiles, SFU relay, --camera in clustered mode, real speaker output (pending the ALSA recipe fix).
@transfix
transfix force-pushed the feat/ariadne-conference-live branch from 647be59 to d0c3511 Compare October 19, 2026 01:36
@transfix
transfix merged commit 42d1696 into master Oct 19, 2026
16 of 17 checks passed
transfix added a commit that referenced this pull request Oct 19, 2026
Resolve conflicts: the conference files (ariadne_conference.cpp, conference_live.ari,
room_intrinsics.cpp, room_media_intrinsics.{h,cpp}, room_media_test.cpp) take THIS
branch's versions — master only had the squashed #699/#705 baseline of them, and this
branch is the continuation (N-party, SFU relay + ready-gate, MJPG, --name/--mic,
snapshot bootstrap, UX toggles), verified as a strict superset with no master-unique
change (register_room_media_intrinsics has exactly one caller, ariadne_conference.cpp).
src/cvc/CMakeLists.txt keeps master's addition of ariadne/tvision_backend.cpp.
@transfix
transfix deleted the feat/ariadne-conference-live branch October 29, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant