Skip to content

fix(recording): finalize native Windows recording without renderer round-trip#20

Merged
ThairaHub merged 1 commit into
mainfrom
fix/native-windows-finalize-no-roundtrip
Jun 11, 2026
Merged

fix(recording): finalize native Windows recording without renderer round-trip#20
ThairaHub merged 1 commit into
mainfrom
fix/native-windows-finalize-no-roundtrip

Conversation

@ThairaHub

Copy link
Copy Markdown
Collaborator

Closes #11 (harvested from archived upstream siddharthvaddem#689).

Problem

finalizeNativeWindowsRecording read the entire on-disk screen recording back into renderer memory via readBinaryFile(nativeScreenPath) and shipped those bytes over IPC to store-recorded-session — which then wrote the same bytes back to the same path (resolveRecordingOutputPath(fileName) resolves to where the native helper already wrote the file). For long recordings that's a multi-GB read + IPC marshal + redundant rewrite, with renderer OOM risk on stop — the exact failure mode siddharthvaddem#687 fixed for the webcam sidecar.

The round-trip existed only to attach the webcam sidecar: stop-native-windows-recording already writes cursor telemetry, the session, and the manifest in the main process.

Fix

  • Generalize the macOS attach-native-mac-webcam-recording handler into a platform-agnostic attach-webcam-to-screen-recording (it was always pure disk plumbing; the darwin guard was the only mac-specific part). Error strings made platform-neutral; streamed-webcam rollback behavior unchanged.
  • Windows finalize now calls it with screenVideoPath + the small webcam buffer (empty when the webcam streamed to disk per fix(recording): stream native-capture webcam to disk to prevent OOM crash on stop siddharthvaddem/openscreen#687). The screen file never leaves disk.
  • macOS finalize migrates to the same channel — one handler, two platforms; old channel removed (no remaining references).
  • Webcam attach failure now surfaces a toast (parity with macOS) instead of silently dropping the webcam; the screen-only session from the stop handler still stands.

Acceptance criteria (from #11)

  • readBinaryFile(nativeScreenPath) removed from the renderer finalize path
  • ✅ Main-process handler owns the screen + webcam disk merge/patch
  • ✅ Renderer only marshals small in-memory webcam data (if any)
  • tsc --noEmit 0 errors, biome check clean, vitest 225/225, browser tests 6/6, vite build OK

Note: like upstream's siddharthvaddem#687, the native Windows/macOS capture finalize can't be exercised in unit tests (needs the platform helper + real camera). The renderer↔main streaming contract is covered by the existing recorderHandle/recordingStream tests.

🤖 Generated with Claude Code

…und-trip

The Windows native finalize path read the entire on-disk screen
recording back into renderer memory (readBinaryFile) and shipped it
over IPC to store-recorded-session, which rewrote the same bytes to the
same path — a multi-GB transfer with renderer OOM risk on stop, just to
attach the webcam sidecar.

Generalize the macOS attach handler into a platform-agnostic
attach-webcam-to-screen-recording: the screen file stays on disk and
the renderer only marshals the small in-memory webcam buffer (empty
when the webcam streamed to disk). The macOS path migrates to the same
channel. Stop handler already owns telemetry/session/manifest; attach
rewrites the manifest with the webcam path.

Closes #11

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ThairaHub ThairaHub merged commit cc6ce99 into main Jun 11, 2026
4 checks passed
@ThairaHub ThairaHub deleted the fix/native-windows-finalize-no-roundtrip branch June 11, 2026 18:03
@mepsd

mepsd commented Jun 20, 2026

Copy link
Copy Markdown

is this available in release build?

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.

perf(recording): stream native Windows screen recording to main process without renderer round-trip

2 participants