Repository navigation
cvc::gl::ariadne: stream_view widget — live stream (or static image) in an ImGui window - #536
Merged
Merged
Conversation
…) 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
enabled auto-merge
October 2, 2026 06:58
…-widget # Conflicts: # src/cvcGL/CMakeLists.txt
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.
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: Ncustom widget (counterpart to thestreamscene node, which fills a 3D quad). It draws a livecvc::ariadne::stream(video) inside an ordinary Ariadne window — ImGui gives draggable/resizable for free, and geometry persists via the §11.4tree.<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 callsset_image(token, to_image(f))thendraw_image(token, width). All GL upload / dirty / keepalive /ImGui::Imageis the unchangedKind::Imagemachinery — no new GL code.to_imagealiases 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 withsynthetic_source— frame→image, dims/format, seq dedup + strict monotonicity. The GL/ImGui draw reusescvcgl_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<=0guard, 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.