Skip to content

ariadne: conference host (§8) + live camera self-view - #699

Merged
transfix merged 3 commits into
masterfrom
feat/ariadne-conference-host
Oct 19, 2026
Merged

transfix merged 3 commits into
masterfrom
feat/ariadne-conference-host

Conversation

@transfix

Copy link
Copy Markdown
Owner

Ariadne conference host (§8) + live camera

The conference-app host bundle (roadmap §8): the only C++ a conference .ari needs. It extends the stock cvcGL Ariadne runner with the five stream/media registrations, then runs a document that drives the entire media pipeline from the DSL program lane — no C++ opens a stream.

What's here

  • ariadne_conference — the host. Registers register_stream_intrinsics (core), register_gl_stream_intrinsics, register_media_intrinsics, register_stream_node_type (type: stream), and register_stream_view_widget (type: stream_view), loads a .ari, runs the frame loop, and verifies the streams the document opened.
  • conference_media.ari — a pure-DSL demo: from on_tick, it (stream-open)s a camera and a mic, attaches producers with (stream-capture-camera)/(-audio), renders the video in a reactive stream_view widget, and (stream-play-audio)s the mic. Hardware-free by default (synthetic test pattern + 440 Hz tone), so it runs and verifies headless.
  • --camera — opens a real webcam for the self-view. A camera dictates its own resolution, so the DSL can't pre-size a stream to it; the host opens the device in C++, sizes the stream to it, sets cam_live/cam_token, and the .ari binds the widget to that token (skipping its synthetic open). Audio stays the DSL tone.

Camera capture fix (affects ariadne_stream --camera too)

Webcams default to MJPG (compressed). SDL handed fill() the raw JPEG bytes in an SDL_PIXELFORMAT_MJPG surface, and SDL_ConvertSurface does not decode JPEG — it reinterpreted the compressed bytes as pixels, so the stream carried garbage (a green/striped pattern). The capture seam now enumerates the device's formats and opens with the best uncompressed one (YUY2/RGB), scored by smoothness×resolution. Frames then convert cleanly to rgba8.

Verification

  • Headless, synthetic: --offscreen → 2/2 streams opened from the .ari program lane (video in the stream_view widget + audio tone played); PNG confirms the animating test pattern.
  • Live camera: --camera on a UVC webcam → selects YUY2 800x600 @ 20fps, opens conference.streams.selfcam, and the stream_view widget shows the real feed with correct colors (verified visually).

Both the schema: /windows/0/children/3/size and stream_view ... no registered handler warnings are cosmetic (the backend's register_widget renders the widget regardless).

Run it

ariadne_conference conference_media.ari              # synthetic, navigable window
ariadne_conference conference_media.ari --camera     # real webcam self-view (SDL)
ariadne_conference conference_media.ari --offscreen --png conf.png

Next

§4b room verbs (join/publish/subscribe/roster) + §5 control plane, toward a two-instance native conference over the merged cross-node gRPC StreamTransport.

The conference host wiring (§8): ariadne_conference is the stock cvcGL Ariadne
runner plus the five stream/media registrations a conference .ari needs --
register_stream_intrinsics (stream-open/info/close), register_gl_stream_intrinsics
(gl-bind-stream), register_media_intrinsics (capture-camera/-audio, play-audio),
register_stream_node_type (type: stream) and register_stream_view_widget
(type: stream_view). It opens NO stream in C++.

conference_media.ari drives the whole capture -> stream -> render/play pipeline
from the DSL program lane: on_tick opens a 640x480 camera + a 48kHz mic, attaches
a synthetic video producer + a 440 Hz tone, binds the camera into a reactive
stream_view widget, and plays the mic. Hardware-free by default, so it runs and
verifies HEADLESS (software GL): 2/2 streams open, the synthetic video renders in
the widget, the audio player drains. A CVC_ENABLE_SDL build drives real devices.

This closes gap 2 of the conference roadmap (the host wired none of it); the §4b
room verbs build on exactly these tokens.
…t to MJPG)

SDL opens a camera in the device's default format, which for most webcams is MJPG (compressed). SDL hands fill() the raw JPEG bytes in an SDL_PIXELFORMAT_MJPG surface, and SDL_ConvertSurface does not decode JPEG — it reinterprets the compressed bytes as pixels, so the stream carried garbage (a green/striped pattern) instead of video.

Enumerate the device's supported formats and open with the best uncompressed one (skip MJPG/unknown), scoring by smoothness×resolution with fps capped at 30; the delivered YUY2/RGB frames then convert cleanly to rgba8. Falls back to the device default only when a camera is compressed-only (rare). Fixes the live feed for both ariadne_stream --camera and ariadne_conference --camera.
A camera dictates its own resolution, so the DSL cannot pre-size a stream to it. With --camera, the host opens the self-view camera in C++, sizes the video stream to the device, and sets cam_live=1 + cam_token in state; conference_media.ari then skips its synthetic open and binds the stream_view widget to that token. Audio stays DSL-driven (the 440 Hz tone). Hardware-free without --camera, exactly as before.
@transfix
transfix merged commit ef633b9 into master Oct 19, 2026
25 of 26 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.
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