perf(recording): stream native Windows screen recording to main process without renderer round-trip
Author: coderabbitai[bot]Created Jun 6, 2026Updated Jun 6, 2026
Summary
Currently, the native Windows finalize path (finalizeNativeWindowsRecording in src/hooks/useScreenRecorder.ts) reads the entire on-disk screen recording back into renderer memory via window.electronAPI.readBinaryFile(nativeScreenPath) and ships those bytes to the main process via storeRecordedSession. For long recordings this can be a multi-GB IPC transfer and risks an OOM crash in the renderer on stop — even after the webcam sidecar OOM fix in #687.
Proposed fix
Add a dedicated main-process IPC handler (e.g. attach-webcam-to-screen-recording) that accepts:
- The native screen file path (already on disk)
- The webcam sidecar file name / whether it is streamed
- A small duration-fixed webcam blob buffer (only when not streamed)
The main process reads, patches, and merges the files itself — the renderer never marshals the multi-GB screen bytes over IPC.
Context
- Pre-existing limitation, not introduced by #687.
- #687 eliminated the webcam sidecar OOM by streaming it to disk; this issue tracks the analogous fix for the screen recording.
- Discussed in: https://github.com/siddharthvaddem/openscreen/pull/687#discussion_r3367165273
- Related PR: #687
Acceptance criteria
-
readBinaryFile(nativeScreenPath)is removed from the renderer finalize path - A main-process handler owns the screen + webcam disk merge/patch
- Renderer only marshals small in-memory webcam data (if any)
- Existing
tsc --noEmit,biome check, andvitestchecks remain green
Source: siddharthvaddem/openscreen