Repository navigation
conference: an unreliable fast lane for pose snapshots (WebRTC data channels) - #949
Merged
transfix merged 2 commits intoNov 1, 2026
Merged
Conversation
transfix
force-pushed
the
feat/conf-unreliable-transport
branch
from
November 1, 2026 00:59
3b4a6cd to
43d5913
Compare
…hannels) Each client may open WebRTC data channels to the relay beside its reliable connection, unordered and never waited for: a pose lane (maxRetransmits 0) and, with arisrv --lane-media on, a media lane (lifetime 100 ms). Each is its own peer connection on the relay's one UDP port (ICE UDP mux, host candidates, no STUN/TURN), so poses never queue behind video in one SCTP congestion window. The room tree stays on gRPC/WebSocket. The pose lane carries room_pose_relay's PoseSnapshot stream. On the lane the encoder runs acked (pose_stream_encoder::set_acked): nothing commits on write, every snapshot differs from the last one the viewer acknowledged, so a lost one is superseded by the next. The client decodes with 32 kept bases (pose_stream_decoder::set_bases), acks what it decodes, and applies the samples with apply_pose_samples. A keyframe keeps the bases: until its ack, every snapshot is base 0 and any of their acks may become the base. The rate (60/30/20 Hz, fed the lane's RTT), the area of interest and the 2 s keyframe are unchanged; opening or closing a lane restarts the stream on the new path. - cvc::net: fast_lane (datagram envelope, codecs, hub) and fast_lane_rtc (libdatachannel natively, datachannel-wasm in the browser), behind CVC_ENABLE_RTC (default OFF; inert stubs without it). - Signaling: a ttl-0 state_message at <participant>.lane.<pose|media>, never forwarded; the answer goes through the new state_transport::send_message_to, written through the admission hold. - The media lane server is a media_endpoint (AOI gate, rung shaper); the reliable endpoints send a lane viewer no media; lane link reports first. - arisrv --lane-listen/--lane-advertise/--lane-media; arigl CVC_ARIADNE_LANE=1; cyprty ?lane=1; arisrv_aoi_bench --lane rtc with pose-arrival, pose-age, media and correction probes. Measured on catx-03 (netns + netem, 2 clients, 60 Hz snapshots, camera + mic, 3 runs per lossy row): pose arrival p99 21-25 ms on the lane against 71-139 ms over WebSocket and 74-98 ms over gRPC at random loss; pose age p99 51-62 ms against 84-141 ms. Under bursty loss gRPC can stall for seconds whatever carries the poses (it queues every write). Media stays on the connection by default: usrsctp's congestion control was slower than TCP's under loss. Design and tables: docs/roadmap/CONFERENCE_UNRELIABLE_TRANSPORT.md.
…des and at both client rates The snapshot session's corrected reruns (#951): tree poses stalled 3 of 3 at 60 Hz client frames and 1 of 3 at 30 Hz; snapshots 0 of 3 and 2 of 3. Neither the snapshots nor the 60 Hz client rate cause it, and the media stall drop never fired in any of the 15 runs.
transfix
force-pushed
the
feat/conf-unreliable-transport
branch
from
November 1, 2026 03:24
43d5913 to
2b1a340
Compare
transfix
changed the base branch from
feat/conf-pose-snapshots
to
feat/conf-pose-snapshots-v2
November 1, 2026 03:24
transfix
added a commit
that referenced
this pull request
Nov 2, 2026
…Hz (#951) * Conference: avatar poses as compact per-viewer snapshots at up to 60 Hz Poses used to replicate as room-tree leaves: - about 110 bytes for each changed number, roughly 780 bytes per walking avatar per update, sent as 7 separate messages; - at the relay's 20 Hz step; - to every client alike. Each viewer now gets its own stream: - The relay steps the room at 60 Hz. room_pose_relay sends each viewer that is due one PoseSnapshot frame (a new Frame kind on both transports) with the participants it sees. - Positions go in mm, velocities in mm/s, and quaternions as components times 32767. - Each value is the difference from what that connection was last sent (pose_stream.h): a walking avatar costs about a dozen bytes, and a still one a two-byte heartbeat a second. - A viewer's rate follows its round trip from the link reports: 60 Hz under 80 ms, 30 Hz under 160 ms, 20 Hz beyond, with 10% hysteresis. - Middle and outer AOI pairs keep the push cadence. - Every 2 s a viewer's stream restarts with absolute entries, so a client that lost its place (a snapshot written into a dying connection) is back in step. - Snapshots are link-level like media: never journaled, relayed or bridged. A WebSocket peer backed up past 64 KB skips one, and the next carries the difference. - The tree's copy of the poses drops to 1 Hz, for late joiners and the log. Clients (arigl, and the bench) apply snapshots through apply_pose_snapshot before client_pump. The holon's playout learns the shorter interval; its assumed interval before measuring is now 2 ticks. arisrv_aoi_bench gains --poses tree|stream, --client-hz, a per-receiver snapshot byte count and a peer-lag probe. On loopback with clients at 60 fps: - 2 clients: 168 kb/s into each client and 70/87 ms peer lag (p50/p95) become 47 kb/s and 48/62 ms. - 6 clients, gRPC and WebSocket mixed: 400-431 kb/s and 103/130 ms become 92-122 kb/s and 42/60 ms. - The relay's output drops from 2.5 to 0.66 Mb/s, and its room step from 4.9 ms to 0.6 ms (p50). * conference: an unreliable fast lane for pose snapshots (WebRTC data channels) (#949) * conference: an unreliable fast lane for pose snapshots (WebRTC data channels) Each client may open WebRTC data channels to the relay beside its reliable connection, unordered and never waited for: a pose lane (maxRetransmits 0) and, with arisrv --lane-media on, a media lane (lifetime 100 ms). Each is its own peer connection on the relay's one UDP port (ICE UDP mux, host candidates, no STUN/TURN), so poses never queue behind video in one SCTP congestion window. The room tree stays on gRPC/WebSocket. The pose lane carries room_pose_relay's PoseSnapshot stream. On the lane the encoder runs acked (pose_stream_encoder::set_acked): nothing commits on write, every snapshot differs from the last one the viewer acknowledged, so a lost one is superseded by the next. The client decodes with 32 kept bases (pose_stream_decoder::set_bases), acks what it decodes, and applies the samples with apply_pose_samples. A keyframe keeps the bases: until its ack, every snapshot is base 0 and any of their acks may become the base. The rate (60/30/20 Hz, fed the lane's RTT), the area of interest and the 2 s keyframe are unchanged; opening or closing a lane restarts the stream on the new path. - cvc::net: fast_lane (datagram envelope, codecs, hub) and fast_lane_rtc (libdatachannel natively, datachannel-wasm in the browser), behind CVC_ENABLE_RTC (default OFF; inert stubs without it). - Signaling: a ttl-0 state_message at <participant>.lane.<pose|media>, never forwarded; the answer goes through the new state_transport::send_message_to, written through the admission hold. - The media lane server is a media_endpoint (AOI gate, rung shaper); the reliable endpoints send a lane viewer no media; lane link reports first. - arisrv --lane-listen/--lane-advertise/--lane-media; arigl CVC_ARIADNE_LANE=1; cyprty ?lane=1; arisrv_aoi_bench --lane rtc with pose-arrival, pose-age, media and correction probes. Measured on catx-03 (netns + netem, 2 clients, 60 Hz snapshots, camera + mic, 3 runs per lossy row): pose arrival p99 21-25 ms on the lane against 71-139 ms over WebSocket and 74-98 ms over gRPC at random loss; pose age p99 51-62 ms against 84-141 ms. Under bursty loss gRPC can stall for seconds whatever carries the poses (it queues every write). Media stays on the connection by default: usrsctp's congestion control was slower than TCP's under loss. Design and tables: docs/roadmap/CONFERENCE_UNRELIABLE_TRANSPORT.md. * docs(fast lane): the gRPC bursty-loss stall is random in both pose modes and at both client rates The snapshot session's corrected reruns (#951): tree poses stalled 3 of 3 at 60 Hz client frames and 1 of 3 at 30 Hz; snapshots 0 of 3 and 2 of 3. Neither the snapshots nor the 60 Hz client rate cause it, and the media stall drop never fired in any of the 15 runs. * Jolt rollout tests: room for macOS arm64's Jolt runs On macOS (package-macos release-grpc jobs) the held-out calibration closes the dissipation to 0.152 against a 0.15 bound and its calibrated step's twist is 1% over the uncalibrated one's, and the gradient check's beta and gamma (a quarter of alpha there) flip sign against Jolt's finite differences while the gradient as a whole agrees (ratio 0.92). The calibration's margins are 0.2 and 5%; the per-bias checks apply to components at least a third of the largest (all three on Windows), and the whole-gradient check is unchanged. * holon_sync_test: the reserve is written on steps that skip the poses
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 conference's pose snapshots can now travel an unreliable, unordered transport beside each client's reliable connection, QuakeWorld-style: a lost packet is superseded by the next, and nothing waits behind it. The room tree (roster, scene, intents, chat) stays on gRPC / WebSocket as it is.
Stacked on #951 (
feat/conf-pose-snapshots-v2, the PoseSnapshot stream rebased onto master after #945), so this diff is only the lane. It gets retargeted to master when #951 lands, and merges on full green CI. libcvc's build and format checks only run on PRs into master.Design and measurements:
docs/roadmap/CONFERENCE_UNRELIABLE_TRANSPORT.md.What it is
Two WebRTC data channels per client, each its own peer connection to the relay, both unordered:
maxRetransmits 0) for pose snapshots and their acks;arisrv --lane-media on).Separate associations keep the poses out of the video's SCTP congestion window. On one association, under 3 % loss, the poses queued behind the video at the sender (doc §7).
Libraries: libdatachannel natively, datachannel-wasm in the browser. Both are cvcpkg recipes: recipes: libdatachannel 0.24.6 and datachannel-wasm 0.4.0 (WebRTC data channels) cy-pca/cvcpkg#539.
CVC_ENABLE_RTC(default OFF). Without it the lane classes are inert stubs, so callers need no#if, and every client stays on its reliable connection.Relay.
arisrv --lane-listen 0.0.0.0:7703 [--lane-advertise <public ip>]. Off by default.Signaling.
state_messagewith ttl 0 at the participant's own path (<participant>.lane.<pose|media>). A relay now delivers ttl-0 messages to its own shards only and forwards them nowhere.state_transport::send_message_to(pid, msg), to that participant's connections alone, and also through the admission hold.Poses: the PoseSnapshot stream, acked.
PoseSnapshot(Frame field 13's message).room_pose_relay::set_lane: a viewer whose pose lane is open gets its snapshots there. Same area of interest, same 60/30/20 Hz rate (fed the lane's RTT), same 2 s keyframe. Opening or closing the lane restarts the stream with a keyframe on the new path.pose_stream_encoder::set_acked: on the lane nothing commits on write. Each snapshot gets its own seq and its state is kept (64) until the viewer acks one. That one becomes the base, so a lost snapshot is carried by the next. Commit-on-write is unchanged on the reliable path.pose_stream_decoder::set_bases(32): the client keeps the last 32 decoded states by seq, applies a snapshot against the base it names (a missing base is a gap, as before), and acks it. An older tick still becomes a base but gives no samples. A keyframe keeps the bases, because until its ack every snapshot is base 0 and the relay may take any of their acks.apply_pose_samples(new in holon_sync, called byapply_pose_snapshottoo).The relay stays the hub for media.
media_endpoint, so the area-of-interest gate and the per-viewer rung shaper apply to it unchanged.Liveness.
Clients.
CVC_ARIADNE_LANE=1; cyprty with?lane=1.arisrv_aoi_bench --lane rtcruns the same (it needs--poses stream).Measured
catx-03, unprivileged netns with netem on loopback; 2 clients, 60 Hz snapshots and client frames, 15 fps 5.4 KB camera + Opus mic, 30 s.
Over 3 runs of each lossy row (ms; a range where runs differ):
stalled 0). With poses on the lane, gRPC carried the media without a stall in 3 of 3 runs, but at these odds that is only a hint. Doc §7.4 item 3.Reconcile corrections (
probes.correction_sum_m, m over 30 s, each run):The intents still ride the reliable connection, stamped against the lane's quicker server ticks. That is my guess for the WebSocket gap, and it is not yet measured. Intents on the lane are the next step (doc §9).
Tests
fast_lane_test, 13 cases:room_pose_relayonto a lane and back (a third of the snapshots lost, within 1 mm of the server, keyframes on each switch);Passes 13/13 on Windows (MSVC) and Linux (catx-03, gcc 11). pose_stream_test 9/9 and holon_sync_test 17/17 on both.
Regression suites on Windows: state_transport_ws 40, state_transport_grpc 46, room_aoi 14, room_aoi_relay 10, room_relay_integration 16, room_media 2.
The stub path (no
CVC_ENABLE_RTC) compiles. CI builds it.cyprty (wasm,
CVC_ENABLE_RTC=ON) builds against the datachannel-wasm recipe. The browser run in doc §7.5 is from before the PoseSnapshot rework. That session had both lanes open against a local arisrv, with media in and acks back. It needed the recipe'sheap-views.patch. One session of three hit an uncaught Asyncify exception, so the lane is opt-in until that is reproduced.Not in this PR
--lane-listen, so it waits for a go-ahead.CVC_ENABLE_RTCis off there).