Repository navigation
ariadne: multi-party video conference — SFU relay, real A/V, MJPG, N-party, UX toggles, Windows - #719
Merged
Merged
Conversation
…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).
… (star topology) state_transport_grpc::set_relay(true) makes a node forward a mutation/message frame RECEIVED from one connection to every OTHER connection (skipping the origin), so clients that connect only to this server still converge with each other — the foundation for a hosted, NAT-friendly conference where clients connect to the server, never to each other. A leaf node (default) applies received frames locally and never re-sends; origin_node_id is preserved so dedup / vector clocks still work end-to-end. Test RelayForwardsBetweenStarClients: a write on client A reaches client B through a relay R that A and B each dial but never dial directly.
…se the relay as source register_room_media_intrinsics + room_publish take an optional relay_endpoint. When set (SFU), room-publish serve()s (pushes) the stream to the relay and advertises the RELAY as the descriptor's endpoint, so subscribers pull the relayed copy through the server and media never flows client-to-client (NAT-safe). Empty = mesh, unchanged (serve_port + advertise own endpoint). room-subscribe is untouched — it already pulls from whatever endpoint the descriptor advertises. The relay server that fans these out (ariadne-server) is next; the mesh room_media_test stays green.
…t id alone The SFU relay keyed its per-stream proxies on stream_params.id, so two streams that share an id in different scopes — exactly a conference, where every participant publishes id "camera"/"audio" under its own pid scope — collided: relay() took the idempotent early-return and silently dropped every participant but the first. The server relayed 2 of 4 streams and peers behind the second publisher received nothing. Key the proxy map on registry_key(root_path, id) — the canonical identity, which equals the token — so same-id streams in different scopes each get their own proxy. Add StreamRelay.ScopedSameIdNoCollision (the existing tests only used globally-unique ids, so the collision was uncovered).
…ted subscribe Add the ariadne-server binary (core libcvc + gRPC only, no GL/VTK): it relays the room-tree control plane (state_transport set_relay, star topology) and the media plane (a stream_relay driven by room_relay_tick), so friends behind home NAT reach a conference through one server instead of peer-to-peer. --media-server on ariadne_conference switches the client to SFU (room-publish push()es to the relay and advertises it as the source). Close the SFU pull race: a subscriber could see a published descriptor (hence the relay endpoint) a few hundred ms before the relay process had wired that stream, and pull_from succeeds on the open-send alone — so the pull attached to a dead sink and no frame ever arrived (subscribe looked live; peer tile stayed blank). The SERVING side now marks the descriptor ready — the publisher itself in mesh, the relay (once ingest+egress are wired, in room_relay_tick) in SFU — and room_subscribe gates the pull on it; the .ari retry loop waits for ready. The server pump_all()s each tick so its ready markers reach clients (collect_local never re-pumps the clients own replicated mutations, so this cannot echo). Add RoomMedia.SfuRelayReadyGateAndDelivery: a 3-node (A/B/relay) test proving the gate (a pre-ready subscribe is refused, not a silently-dead proxy) and end-to-end A -> relay -> B frame delivery.
…-camera/--mic) Wire real devices into the live multi-instance conference so friends see/hear each other, not synthetic test media: - --mic: the .ari captures the real recording device (stream-capture-audio device 0) when mic_live, else the 440 Hz tone (headless/CI). Audio has a fixed format, so the DSL can open+size it directly. - --camera: the HOST publishes the real device camera. A camera dictates its own resolution and only the host (which opens the device) knows it to size the stream, and room-publish needs a stream it can serve — so the host calls room_publish once the .ari has joined the room (roster contains our pid), and the .ari skips its synthetic camera when cam_live. The clustered self-camera id is now "camera" (token <node>.streams.camera) so it matches the "camera" kind the peer subscribes to and the host end-check. Audio playback uses the relocatable alsa-lib (ALSA_CONFIG_DIR + ALSA_PLUGIN_DIR, set by the client launcher); frames still cross node-to-node over the SFU relay. Camera frames need an on-screen SDL event pump (friends run windowed); the open + publish path is exercised headless.
…t calls Raw rgba8 video is ~1.9 MB/frame (~460 Mbps at 30fps) — fine on a LAN but far beyond any home-internet uplink, so a conference over the internet stalled on bandwidth (and gRPC flow-control made large frames RTT-bound on top of that). Compress video to JPEG: - jpeg_codec (libjpeg-turbo tj3): encode_rgba_to_jpeg / decode_jpeg_to_rgba, thread-local handles. Guarded by CVC_HAVE_TURBOJPEG (no-op where the prefix lacks turbojpeg, e.g. wasm). - jpeg_encode_source: a frame_source wrapping an rgba8 source (camera/synthetic), emitting JPEG. - host --camera opens the self-camera stream as codec "mjpeg" (encode the device frames); the stream_view decodes "mjpeg" frames to rgba8 for display. The relay forwards opaque bytes unchanged. ~13-50x smaller (roundtrip-verified), which brings video within a home uplink. Synthetic (no-camera) video stays raw for now. cvcGL links libjpeg-turbo::turbojpeg when present.
…-capture-camera jpeg) Add a "jpeg" option to stream-capture-camera that wraps the source (synthetic or device) in jpeg_encode_source; conference_live.ari opens its synthetic self-camera as codec "mjpeg" and captures with jpeg #t. So a camera-less peer (synthetic feed) is also network-friendly, and a 2-client test where only one side has a webcam still exercises MJPG on both tiles.
…deo) The stream-open verb rejected codec "mjpeg" — codec_channels() returns 0 for any non-raster codec, so only the host C++ path (sx::stream::open) could open a compressed-video stream, and a .ari could not. A camera-less peer in conference_live.ari therefore failed to publish its synthetic video (0 streams relayed, 0/2 subscribed). Add an mjpeg/jpeg branch to the video path: frame_kind video_raw, w/h as the DECODED resolution (the stream_view decodes with the JPEG header), and a byte slab from explicit "bytes" or a generous w*h (no fixed channels/stride for variable-size JPEG frames). Verified locally: two synthetic-MJPG clients subscribe 2/2 and the relay fans out all 4 streams, decoding cleanly.
…etworks Media rides a SYNC bidirectional gRPC stream, so a Write blocks when the HTTP/2 flow-control window is exhausted. Over a high-RTT internet path the small default window refills only once per round-trip, so the Write stalls roughly every frame and media throughput collapsed to ~3 fps/stream over paladin (vs ~1900 fps aggregate on a local relay) — regardless of frame size, which is why even MJPG stayed choppy. Add long-fat-network tuning to BOTH the server (egress writes) and the channel: a large per-stream HTTP/2 lookahead window (16MB) so many frames are in flight, BDP probing to keep it sized, a larger max frame size, and keepalive so the window does not collapse on brief idles. Local SFU unchanged (2/2 subscribed, relay fanned out 15984 frames).
…namic tiles, late-joiner snapshot
The clustered conference now scales past 2 parties with no per-peer command-line
wiring. A participant joins with just --name (defaults to the host name) plus the
shared --state-peer/--media-server; everyone else is discovered from the replicated
room roster, so --peer-id is gone (deprecated/ignored).
- ariadne_conference: drop --peer-id; --name aliases --node-id and defaults to the
host name when clustered. On connect, request_snapshot("conf") bootstraps the whole
room tree (participants + stream descriptors) so a late joiner converges on peers
who joined before it — journal backfill alone carries only new mutations. The
end-of-run report counts subscribed cameras across every non-self roster entry.
- conference_live.ari: the on_tick lane discovers every other participant from
(room-roster conf.room), subscribes each once, and assigns tile slots peer.<i>.cam /
peer.<i>.name with peer.count. The UI grows one group per peer (name + video) via
repeat; the Me/status/header binds avoid str-concat (the read-lane lacks it).
- room_intrinsics: room-roster accepts a bare room-id string, not just a join handle,
so the .ari can iterate (room-roster (state-get "conf.room")).
Verified offscreen (llvmpipe): A, B, and a late-joining C each converge to
subscribed 2/2 with roster A,B,C; the C tile shows named A+B video; no bind errors.
Add per-participant mic/cam on-off buttons to the conference. Muting blanks the
producer AT THE SOURCE without tearing the stream down, so the descriptor, the
peers' subscriptions and the frame cadence all stay live — peers just see black
video / hear silence while you are muted.
- stream (general): a `muted` atomic flag (set_muted/muted/mute_flag). A general
muted_source frame-source decorator drains its inner source every tick (keeping
a device and its clock live) but zeroes the slab while the flag is set. Zero is
the right blank for both conference kinds: f32 audio zeros are silence, and rgba8
zeros encode to a BLACK JPEG (JPEG carries no alpha), so muting happens BEFORE the
jpeg encoder.
- media_verbs: stream-capture-camera / -audio wrap their source in a muted_source
bound to the stream's mute_flag(); new (stream-set-muted TOKEN BOOL) verb flips it.
- ariadne_conference: the host-owned --camera stream isn't in the document table (so
the DSL verb can't reach it) — wrap it in a muted_source too and drive its flag
from the render loop by polling the .ari's cam_on.
- conference_live.ari: "camera on/off" + "mic on/off" buttons in the Me window flip
cam_on/mic_on and call stream-set-muted (mic + synthetic cam are document streams;
the host cam is handled by the poll above); status text shows ● on / muted.
Verified: unit tests MutedSource.{PassesThroughThenBlanksThenPassesAgain,
PropagatesStopFromInner} (all 35 stream_test green); and offscreen render — a muted
synthetic camera shows a BLACK self tile where the unmuted one shows the pattern, and
the on/off buttons + status render.
… build workflow Toward a Windows conference client. All deps build on Windows already (grpc proven in #643's package-windows / libcvc-release-grpc; cvcGL + libjpeg-turbo have Windows support), so the only source gap was the hostname default. - ariadne_conference: the --name default read the host name via POSIX gethostname (<unistd.h>), which doesn't exist on Windows. Read COMPUTERNAME there instead (reliably set on Windows, and avoids pulling in <windows.h> and its macro collisions just for GetComputerName); POSIX keeps gethostname. - .github/workflows/ariadne-conference-windows.yml: a manual (workflow_dispatch) Windows build that mirrors ci.yml's package-windows dep provisioning (cvcpkg for Boost/HDF5/VTK/SDL3/imgui/libjpeg-turbo + grpc/protobuf), configures with CVC_BUILD_CVCGL + CVC_ENABLE_GRPC + CVC_BUILD_EXAMPLES, and builds only the two conference targets (ariadne_conference + ariadne-server) so an unrelated example's Windows gap can't block them, then uploads the exes + first-party DLLs.
…patch needs the default branch)
…ehind CVC_ENABLE_SDL The first Windows build (no SDL3 in the prefix -> CVC_ENABLE_SDL off) failed: media_verbs.cpp used cvc::gl::capture::jpeg_encode_source for the synthetic+jpeg path (not SDL-gated), but its header was included only inside #ifdef CVC_ENABLE_SDL. jpeg_encode_source is turbojpeg-based, not SDL — move its include out of the guard (the .cpp is GLOB-compiled unconditionally, so it already links). Only the real SDL device sources (camera_source/audio_source) stay guarded. No Linux change (SDL on). Also widen the ariadne-conference-windows trigger to the conference source surface (cvcGL + ariadne + the server tool + state transports) and add a cancel-in-progress concurrency group, so a fix anywhere in that surface re-runs the Windows build and rapid pushes don't pile up.
…_ENABLE_SDL) on Windows The first Windows build had no SDL3 (mirrored package-windows, which builds cvcGL without it), so CVC_ENABLE_SDL was off and the client was synthetic-A/V only. SDL3 has a Windows cvcpkg build (recipes/sdl3/build.ps1), so install it into the deps prefix; find_package(SDL3) then enables CVC_ENABLE_SDL and the real camera/mic + input seam compile. This exercises the SDL device paths (camera_source/audio_source/ SdlInput) on Windows for the first time.
… runtime DLLs + README) Now that the client compiles on Windows with SDL3 (real camera/mic), stage a runnable bundle: the exes plus every runtime DLL (first-party cvc/cvcGL + all cvcpkg deps — SDL3, VTK, gRPC/protobuf/abseil, turbojpeg, Boost, ...) flat in one dir so Windows' same-directory DLL search resolves them with no launcher, plus a README with the join command and the VC++ redist note. Fat for now (a dumpbin-closure slim is a follow-up).
… not a col-0 here-string The previous run failed to parse: a PowerShell here-string (@"..."@) puts its content and closing "@ at column 0, which terminates the YAML 'run: |' literal block. Build the README from an indented single-quoted string array + Set-Content instead (YAML-safe).
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.
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The flagship multi-party Ariadne video conference, built on the cross-node streaming substrate. Authored as an
.aridocument (conference_live.ari), hosted byariadne_conference, with a headless SFU relay (ariadne-server). Namespacecvc::ariadne::conference(the conference is a layer;cvc::ariadne::stream/cvc::gl::ariadnestay task-neutral).What's here
room-join/room-roster/room-leaveover replicated state; trust-all-first self-insert, soft leave, present-only roster.room-publish/room-subscribe— cross-node camera + audio over the gRPCstream_bridge; mesh and SFU (relay) topologies.ariadne-server(core + gRPC, no GL): a headless room-state relay + media SFU.stream_relaykeyed by(scope,id)identity (notidalone, which collided same-id streams); readiness-gated subscribe (the serving side marks the descriptorreadyso a subscriber can't pull a half-wired relay).--camera/--mic): the host publishes the real device camera (sized to the device) + mic; synthetic video + a tone when headless.jpeg_codec+jpeg_encode_source+stream_viewmjpeg decode; DSLstream-openaccepts codec"mjpeg".bdp_probe+ bigger max-frame + keepalive on both the server and channel, so the sync bidi gRPC media stream isn't RTT-bound → full producer rate over a long-fat network.--peer-id;--namedefaults to the host name); dynamic per-peer tiles (name + video) viarepeat; late joiners converge viarequest_snapshot("conf")on connect (journal backfill alone carries only new mutations).muted_sourceblanks the producer at source (f32 silence / black JPEG) without dropping the publish, so peers stay subscribed and the cadence holds.stream.mute_flag()/set_muted()+ a(stream-set-muted TOKEN BOOL)verb..github/workflows/ariadne-conference-windows.ymlbuildsariadne_conference+ariadne-serveron Windows — gRPC + cvcGL/VTK + turbojpeg + SDL3 all compile (MSVC/VS2022).Verified
subscribed 2/2with roster A,B,C (offscreen, llvmpipe); the late joiner's tiles render named A+B live video.MutedSource.*unit tests (all 35stream_testgreen) + offscreen render (a muted synthetic cam shows a BLACK self tile vs the pattern unmuted).ariadne_conference.exe+ariadne-server.exe.paladin.sublevels.net, reachable over the internet (smooth ~30 fps video + audio).Follow-ups (separate work)
state_transport+ WebRTC media so browser clients join the same rooms as native clients (the cyberpcangel.com MVP).ariadne-server → arisrv(src/arisrv/); fold the conference registration into the plannedariglGL runtime (host flags → a declared.ariargs:block).Tracked in
transfix/workstreams:ariadne-conference.