Skip to content

Add streaming recording heartbeat - #185

Draft
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
masterfrom
fix/live-recording-heartbeat
Draft

Add streaming recording heartbeat#185
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 1 commit into
masterfrom
fix/live-recording-heartbeat

Conversation

@irvingoujAtDevolution

Copy link
Copy Markdown
Contributor

Emit output-mirror heartbeat frames while recording to a named pipe so low-motion RDP sessions remain decodable during live playback.

The heartbeat is limited to streaming recordings. Local file recording keeps its configured frame rate.

Submit the current output-mirror framebuffer at 30 FPS while recording to a named pipe. Sparse RDP paints otherwise produce low-density VP8 WebM that Media Foundation buffers until the stream ends instead of rendering live.

Local file recording keeps its configured frame rate and does not start the heartbeat.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 25, 2026 22:12
@irvingoujAtDevolution

Copy link
Copy Markdown
Contributor Author

Implementation notes:

  • Cadeau already supports repeated frame encoding, but MsRdpEx only submitted frames when RDP painted.
  • Media Foundation buffers sparse VP8 live WebM until the stream ends. Re-encoding the same segment at 5 or 8 FPS still failed; 10, 12, 24, and 30 FPS rendered live.
  • The output-mirror heartbeat resubmits the current composed framebuffer at 30 FPS only when RecordingPipeName is set.
  • Local file recording does not start the heartbeat and keeps its configured frame rate.
  • The heartbeat shares the output-mirror lock with paint and teardown; teardown signals and joins it before releasing the framebuffer and recorder.

Validation:

  • Native x64 Release build passed with Visual Studio 2026/CMake.
  • Real RDP → Gateway → Web/C# produced 139/131 packets across the two clips and C# rendered decoded markers; run 67b4f7113e0a4f1384817f8e48f1ff4a.
  • Single-clip real RDP live playback rendered in both Web and C#. C# first recognized marker latency improved from 11.16 seconds without heartbeat to 5.41 seconds with the narrowed heartbeat; run 10ab251d06694234a850f202b988e5dc.
  • The remaining 0.41-second strict-latency miss and multi-clip transition contamination are tracked in the external E2E fixture, not hidden by this PR.

Note

Human-tuned, LLM-assisted content.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds heartbeat frames for named-pipe video recordings to keep low-motion RDP streams decodable during live playback.

Changes:

  • Enforces a 30 FPS minimum for streaming recordings.
  • Adds a heartbeat worker with startup and shutdown handling.
  • Leaves local-file frame rates unchanged.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dll/OutputMirror.c
Comment on lines +58 to +59
MsRdpEx_VideoRecorder_UpdateFrame(ctx->videoRecorder, ctx->bitmapData,
0, 0, ctx->bitmapWidth, ctx->bitmapHeight, ctx->bitmapStep);
Comment thread dll/OutputMirror.c
Comment on lines +73 to +75
if (ctx->heartbeatThread)
{
WaitForSingleObject(ctx->heartbeatThread, INFINITE);
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