Skip to content

cvc::gl::ariadne: stream_view widget — live stream (or static image) in an ImGui window - #536

Merged
transfix merged 2 commits into
masterfrom
feat/ariadne-stream-widget
Oct 2, 2026
Merged

transfix merged 2 commits into
masterfrom
feat/ariadne-stream-widget

Conversation

@transfix

@transfix transfix commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Holy-grail step (c): the widget that shows a stream in a draggable/resizable ImGui window — the demo's centerpiece. Independent of the camera/audio PRs (needs only the merged substrate + the Kind::Image path), so it targets master.

A - type: stream_view / stream: <token> / size: N custom widget (counterpart to the stream scene node, which fills a 3D quad). It draws a live cvc::ariadne::stream (video) inside an ordinary Ariadne window — ImGui gives draggable/resizable for free, and geometry persists via the §11.4 tree.<id> edge. It doubles as a static-image view: with no live stream for the token it draws whatever the host published under that name (set_image).

Reuses the existing ImGui image path end to end — each frame it resolves the token, pulls the newest frame (lock-free latest() + seq dedup), and on a new frame calls set_image(token, to_image(f)) then draw_image(token, width). All GL upload / dirty / keepalive / ImGui::Image is the unchanged Kind::Image machinery — no new GL code. to_image aliases the frame bytes and co-owns the keepalive, pinning the slab across the upload.

Lifetime (render-thread only): one subscription per widget identity, reconciled to the current channel every frame — so a token switch or a close/reopen under the same token rebinds (a reconnecting camera / re-opened record-playback stream recovers) instead of freezing on a dead subscription, releasing the old sub like StreamTextureBinding::release(). latest() after the channel is gone is memory-safe (the widget owns its subscription ref), so the stream need not outlive the widget.

Testing: next_stream_frame_image (the pull step) is exposed and tested hardware-free with synthetic_source — frame→image, dims/format, seq dedup + strict monotonicity. The GL/ImGui draw reuses cvcgl_stream_texture's covered path.

Folds an adversarial review: close/reopen re-subscribe + switchable-token slot release (were: frozen view + leaked subscriptions/pool slots), width<=0 guard, and a documented stream-lifetime contract + the removed-widget residual hold. Note: a backend-registered custom widget draws a cosmetic load-time "no registered handler" warning (the loader is backend-neutral); the widget works.

…) in an ImGui window

The WIDGET half of Phase-3 streaming, counterpart to the "stream" SCENE node: a
`- type: stream_view / stream: <token> / size: N` custom widget that draws a live
cvc::ariadne::stream (video) inside an ordinary Ariadne window, which ImGui makes
draggable/resizable for free (geometry persists via the §11.4 tree.<id> edge). It
doubles as a static-image view: with no live stream for the token it draws whatever
the host published under that name.

Reuses the existing ImGui image path end to end — each rendered frame it resolves
the token, pulls the newest frame (lock-free latest() + seq dedup), and on a new
frame calls set_image(token, to_image(f)) then draw_image(token, width); all GL
upload / dirty / keepalive / ImGui::Image is the unchanged Kind::Image machinery, so
no new GL code. to_image aliases the frame bytes and co-owns the keepalive, pinning
the slab across the upload.

register_stream_view_widget(backend, app) wires the type (needs the app to resolve
tokens). Render-thread only; one subscription per widget identity, reconciled to the
current channel each frame so a token switch or a close/reopen under the same token
rebinds (a reconnecting camera / re-opened record-playback stream recovers) rather
than freezing on a dead subscription — releasing the old sub like
StreamTextureBinding::release(). Calling latest() after the channel is gone is
memory-safe (the widget holds its own subscription ref), so the stream need not
outlive the widget.

next_stream_frame_image (the render-thread pull step) is exposed and tested
hardware-free with synthetic_source (frame->image, dims/format, seq dedup +
monotonicity). The GL/ImGui draw reuses cvcgl_stream_texture's covered path.

Folds an adversarial review: close/reopen re-subscribe + switchable-token slot
release (were: frozen view + leaked subscriptions), width<=0 guard, documented the
stream-lifetime contract and the removed-widget residual hold.
@transfix
transfix enabled auto-merge October 2, 2026 06:58
…-widget

# Conflicts:
#	src/cvcGL/CMakeLists.txt
@transfix
transfix merged commit 2195d00 into master Oct 2, 2026
12 of 13 checks passed
@transfix
transfix deleted the feat/ariadne-stream-widget branch October 29, 2026 20:52
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