Skip to content

Conference: avatar poses as compact per-viewer snapshots at up to 60 Hz - #951

Merged
transfix merged 8 commits into
masterfrom
feat/conf-pose-snapshots-v2
Nov 2, 2026
Merged

transfix merged 8 commits into
masterfrom
feat/conf-pose-snapshots-v2

Conversation

@transfix

@transfix transfix commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Avatar 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.

This PR gives each viewer its own compact pose stream instead.

What changes

Relay

  • The relay steps the room at 60 Hz.
  • room_pose_relay sends each viewer that is due one PoseSnapshot frame with the participants it
    sees. It is a new Frame kind (field 13) on both gRPC and WebSocket.
  • Snapshots are link-level like media: never journaled, relayed or bridged.
  • A WebSocket peer with more than 64 KB queued skips a snapshot; the next one carries the
    difference.

Encoding (pose_stream.h)

  • Positions are in mm, velocities in mm/s, quaternions as components times 32767.
  • Each value is the difference from what that connection was last sent. A walking avatar costs
    about a dozen bytes; a still one, a two-byte heartbeat once a second.
  • Every 2 s a viewer's stream restarts with absolute entries. A client that lost its place (a
    snapshot written into a dying connection) is back in step.

Rate per viewer

  • 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 area-of-interest pairs keep the push cadence.

Tree poses drop to 1 Hz. They remain 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 it has measured one
    is now 2 ticks.

Measured

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:

tree poses snapshots
2 clients: into each client 168 kb/s 47 kb/s
2 clients: peer lag p50/p95 70/87 ms 48/62 ms
6 clients, gRPC and WS mixed: into each client 400-431 kb/s 92-122 kb/s
6 clients: peer lag p50/p95 103/130 ms 42/60 ms
6 clients: relay out 2.5 Mb/s 0.66 Mb/s
6 clients: room step p50 4.9 ms 0.6 ms

Own-avatar reconcile corrections sum about 2x higher with snapshots: more checks, each smaller.

gRPC under bursty loss. netem delay 20ms loss gemodel 1% 30% 100% 0% on loopback; 2 clients
with camera (5400 B at 15 Hz) and Opus mic, their clients at 60 Hz then 30 Hz; 3 runs each.

p95/p99 in ms; the camera rows show how late video arrives.

run tree poses: pose tree poses: camera snapshots: pose snapshots: camera
60 Hz clients, 1 19532/20332 20022/20504 166/1346 520/1626
60 Hz clients, 2 2348/3594 4125/5384 69/167 116/261
60 Hz clients, 3 7470/7818 31374/31844 91/279 281/820
30 Hz clients, 1 6483/7687 6685/7860 452/1505 3014/3767
30 Hz clients, 2 95/279 125/314 75/203 117/268
30 Hz clients, 3 110/600 205/654 422/1256 2370/3602

gRPC can stall for seconds under bursty loss whichever pose mode is used, and at either client
rate. An earlier batch of the same snapshot runs stalled 2 times in 3, so the spread is wide.
gRPC accepts every write and queues it, so a loss burst leaves seconds of media and poses
queued; nothing stale is dropped. This predates this PR, and snapshots neither cause it nor cure
it. The unreliable pose lane (#949, stacked on this) takes poses off TCP; media
on gRPC still needs a bound on what it queues.

Also in this PR

Tests

  • New: pose_stream_test (9).
  • New WS and gRPC tests: PoseSnapshotReachesOnlyNamedPeer.
  • Passing on Windows: holon 31, holon_sync 17, WS 40, gRPC 46, room_aoi 14, room_aoi_relay 10,
    room_relay_integration 16.
  • arigl's main.cpp and the core files compile under emcc.

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).
transfix added a commit that referenced this pull request Nov 1, 2026
…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.
…hannels) (#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.
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.
…shots-v2

# Conflicts:
#	src/arisrv/main.cpp
#	src/cvc/CMakeLists.txt
Both sides kept: arisrv takes the --lane-* and --avatar-* flags, the
CMake list gains avatar_panel.cpp beside the pose stream sources, and
server_pump keeps #956's policy sync and reserve writes with #951's
write_poses switch.

The reserve now goes out every step rather than with the tree poses: the
relay writes those only once a second when it streams snapshots, and no
snapshot carries a reserve. write_reserve already thins it (half a
percent of the reserve, or a 5 s heartbeat).
…shots-v2

# Conflicts:
#	src/cvc/CMakeLists.txt
…shots-v2

# Conflicts:
#	src/cvc/CMakeLists.txt
@transfix
transfix merged commit d6800c4 into master Nov 2, 2026
27 checks passed
@transfix
transfix deleted the feat/conf-pose-snapshots-v2 branch November 2, 2026 07:07
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