Repository navigation
Conference: phone cameras keep their shape; peers move smoothly - #945
Merged
Merged
Conversation
Phone cameras keep their aspect ratio: - In the browser, a phone camera was squashed, for its owner and for every peer. SDL 3.4's browser camera draws each frame into a canvas fixed at the size the track reported when it opened, then stretches it to the size the app asked for (320x240). A portrait phone, or one turned mid-call, came out stretched. - The single-threaded page now captures the camera itself. It reads a <video> on getUserMedia with no size constraint, so the browser cannot crop it. Each frame is drawn at the video's current size, which follows rotation, and the canvas scales it to the budget. - A threaded build keeps SDL but asks it for no size. - The budget turns with the frame (stream::fit_frame): a portrait phone in 320x240 sends 240x320 (180x320 at 9:16), and the JPEG carries that shape to every rung. - stream_view takes `size: [w, h]`, a box the frame is fitted into with its shape kept (Backend::draw_image_fit). ImGui fills the spare space with black bars. The conference tiles are boxes now, so a portrait camera shows whole without growing its window. Peer avatars move smoothly: - Peers moved smoothly for their own user but stuttered for everyone else. The client walked each peer from where it was shown to the newest sample, timed by when that sample arrived, so every late sample stopped the peer and every early one rushed it. - Each peer now plays out from a buffer of its samples. It is shown on a wall-time timeline a delay behind its newest sample: one interval plus a margin for the measured arrival jitter, followed through a lag. - Between samples, position follows a cubic Hermite through both positions and velocities (straight when the velocities don't fit). When the buffer runs dry, the peer carries on along its velocity for up to 200 ms. - A change of course eases out over 100 ms; a teleport is shown at once. - The client clock's re-alignments and slews no longer move peers. - The relay steps the room on a fixed 50 ms grid, sends each step's poses as soon as they are made, and sets TCP_NODELAY on WebSocket sockets. A delayed ACK held small pose writes back. HolonTest.APeerMovesSmoothlyThroughJitterAndLoss walks a peer around a circle. Samples come every 6 ticks, up to 40 ms late, 5% are lost, and the client runs at 60 fps. The same scenario replayed through the old walk: 96 of 599 frames stalled, 286 were off speed, and RMS acceleration was 107 m/s^2. Now: no stalls, none off speed, 2.3 m/s^2 (the walk's own is 2.25).
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.
Fixes two things reported on the live conference.
Phone cameras keep their shape
In the browser, a phone camera looked squashed, both to its owner and to every peer.
Cause. SDL 3.4's browser camera draws each frame into a canvas fixed at the size the track
reported at open, then stretches it to the size the app asked for (320x240). A portrait phone,
or one turned mid-call, came out stretched.
Fix.
Own browser capture (
camera_source.cpp). The single-threaded page now captures the cameraitself:
<video>on getUserMedia with no size constraint, so the browser cannot crop it;it to the budget.
A threaded build keeps SDL but asks it for no size.
Budget turns with the frame (
stream::fit_frame). A portrait phone in 320x240 sends 240x320(180x320 at 9:16), and the JPEG carries that shape to every rung.
stream_viewtakessize: [w, h]. The frame is fitted inside the box with its shape kept(
Backend::draw_image_fit), and ImGui fills the spare space with black bars. The conferencetiles use boxes now, so a portrait camera shows whole without growing its window.
Peers move smoothly
A peer's avatar moved smoothly on their own screen but stuttered for everyone else.
Cause. The client walked each peer from where it was shown to the newest sample, timed by when
that sample arrived. Every late sample stopped the peer, and every early one rushed it.
Fix (
holon::display_pose).timeline a delay behind its newest sample: one interval plus a margin for the measured arrival
jitter, followed through a lag.
(a straight line when the velocities don't fit).
Relay (
arisrv, WS transport).made.
Measured
HolonTest.APeerMovesSmoothlyThroughJitterAndLosswalks a peer around a 4 m circle at 3 m/s.Samples come every 6 ticks, arrive up to 40 ms late, 5% are lost, and the client runs at 60 fps.
The same scenario was replayed through the old walk-from-arrival model:
Tests
All run locally (Windows, static WS+gRPC tree and the shared cvcGL tree):
Holon:
holon_test(31) passes, including the new smoothness, fixed-delay and teleport cases;the peer cases that encoded the old walk are rewritten.
holon_sync_test(17),avatar_sim_test(8) and
room_aoi_test(14) also pass.Transports and relay:
room_relay_integration_test(16),state_transport_ws_test(39) androom_intrinsics_test(15) pass.Media:
media_rungs_testpasses, with a portrait frame keeping its shape on every rung.Stream view:
ariadne_stream_view_testpassesfit_frameand the size parsing. Its terminalbox case is skipped here (no FTXUI in these trees), so CI is the first run of that case.
cvcGL:
cvcgl_media_capturepasses; a portrait capture in the 320x240 MJPEG stream decodes as180x320.
Browser camera:
camera_source.cppcompiles with emcc using the wasm tree's flags;rotation, no double reads, track stopped on close).
It has not run on a phone yet.
arisrv: smoke-ran at its 120 Hz pace.