Skip to content

feat(dgw): stream reconnecting WebM sessions - #1942

Open
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 6 commits into
masterfrom
feat/video-streamer-session-reconnect
Open

irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 6 commits into
masterfrom
feat/video-streamer-session-reconnect

Conversation

@irvingoujAtDevolution

@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Gateway WebM shadowing now consumes a recording event stream so clips can reconnect and change size.
The Start/Pull codes stay valid for existing clients.
Push disconnect marks the session ended so viewers receive StreamEnded.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com


Stack created with GitHub Stacks CLIGive Feedback 💬

@irvingoujAtDevolution

Copy link
Copy Markdown
Contributor Author

Implementation notes:

  • New stream_session path: recording events -> normalizer -> protocol.
  • Gateway stream_recording always uses that path for WebM. webm_stream remains for tests/examples.
  • Reconnect keeps the same watch stream state and appends a new clip.
  • handle_disconnect sets ended = true so viewers get StreamEnded instead of waiting for TTL remove.
  • Pipelined Pulls are queued. Extra Start while waiting is still rejected.
  • Legacy clients still speak Start=0 / Pull=1. New server messages are Segment started (1) and Stream ended (3).

Note

LLM-assisted content (no human feedback).

Base automatically changed from refactor/video-streamer-tag-decoder to master August 25, 2026 19:56
Gateway WebM shadowing now consumes a recording event stream so
clips can reconnect and change size. The Start/Pull codes stay
valid for existing clients. Push disconnect marks the session
ended so viewers receive StreamEnded.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep one response per Pull while recordings roll over to new WebM clips.

Recover truncated tails and distinguish reconnectable capture disconnects from terminal recording end.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Launch recording sources only after Start and serve one typed request
at a time. Replace retained GOP payloads with same-handle file replay
and prefetch up to four bounded output chunks.

Process later client requests after the current response instead of
maintaining an extra Pull queue. Separate media, transport, and
protocol tests, and require the bench feature for the benchmark target.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return an error for laced video blocks instead of panicking.
Remove redundant watch state and transient development documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the initial Start response byte-for-byte compatible with the legacy metadata message.
Use a distinct message for later segment boundaries without adding protocol modes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@irvingoujAtDevolution
irvingouj@Devolutions (irvingoujAtDevolution) marked this pull request as ready for review September 18, 2026 14:53
Copilot AI balanced review requested due to automatic review settings September 18, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Protocol compatibility, terminal disconnect handling, shutdown propagation, and adaptive frame skipping remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds reconnecting, multi-clip WebM shadow streaming with resolution-aware segment normalization and an extended WebSocket protocol.

Changes:

  • Tracks recording clips and reconnect events through watch-based state.
  • Normalizes WebM clips into fixed-resolution VP8 segments.
  • Adds message-based transport and extensive protocol/normalizer tests.

docs-compressor was skipped because the more specific prose review covered the intent document.

File summaries
File Description
devolutions-gateway/src/ws.rs Adds message-oriented WebSocket handling.
devolutions-gateway/src/streaming.rs Connects recording events to WebM sessions.
devolutions-gateway/src/streaming.intent.md Documents multi-clip normalization.
devolutions-gateway/src/recording.rs Publishes clip lifecycle and append state.
devolutions-gateway/src/api/jrec.rs Routes shadow requests to session streaming.
crates/video-streamer/src/streamer/signal_writer.rs Signals successful writes.
crates/video-streamer/src/streamer/block_tag.rs Tracks blocks and handles signed timestamps.
crates/video-streamer/src/session.rs Defines the recording-session API.
crates/video-streamer/src/protocol/transport.rs Implements typed transport adaptation.
crates/video-streamer/src/protocol/tests/mod.rs Tests protocol sequencing and failures.
crates/video-streamer/src/protocol/segments.rs Maps normalized segments to responses.
crates/video-streamer/src/protocol/mod.rs Runs pull-driven streaming sessions.
crates/video-streamer/src/protocol/message.rs Defines wire messages and codes.
crates/video-streamer/src/normalizer/tests/replay.rs Tests live-edge replay behavior.
crates/video-streamer/src/normalizer/tests/mod.rs Tests normalization and resource bounds.
crates/video-streamer/src/normalizer/mod.rs Implements WebM normalization.
crates/video-streamer/src/lib.rs Exports the session API.
crates/video-streamer/src/decoder.rs Adds dynamic VPX frame decoding.
crates/video-streamer/Cargo.toml Gates the benchmark behind its feature.
Review details
  • Files reviewed: 19/19 changed files
  • Comments generated: 7
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/video-streamer/src/protocol/message.rs
Comment thread devolutions-gateway/src/streaming.rs Outdated
Comment thread devolutions-gateway/src/streaming.rs Outdated
Comment thread devolutions-gateway/src/streaming.rs Outdated
Comment on lines +58 to +60
We have two streaming sources that we currently support:
1. RDM, which whenver size of a remote connecti session changes, it creates a new clip with consistent size in the header.
2. Chrome/Other browsers, chrome behaves differently, see `webapp/packages/web-recorder`, we use the media recorder API to record the session, the size changing behavior is not documented, but in experiencemnt and in practice, it will sliently change the size of the frame, the webm standard did not advise against this behavior, more lilely, it is undifined, and the client may or may not support it.

### The normalizer

Given the constrains above, we would like to unifiy the source and provide a single shape that the client can consume easily without breaking backward compatibility.
- Every client has an independent output sequence beginning at zero.
```

The client always gets a guaranteed fixed size segment, for the first segment, we keep it backward compatible, the protocol will be extendned, such that, on new `pull` message, when the previous output segment ends, it will send a new `SegmentStarted` message. No newline at end of file
Retain terminal completion across late subscriptions and stop shadow sessions during Gateway shutdown.
Restore adaptive frame skipping and correct the cross-cluster replay fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants