Skip to content

[codex] Fix native Windows recording pause#639

Merged
siddharthvaddem merged 2 commits into
mainfrom
codex/fix-windows-paused-recording
May 23, 2026
Merged

[codex] Fix native Windows recording pause#639
siddharthvaddem merged 2 commits into
mainfrom
codex/fix-windows-paused-recording

Conversation

@EtienneLescot
Copy link
Copy Markdown
Collaborator

@EtienneLescot EtienneLescot commented May 22, 2026

Summary

Adds pause/resume support for native Windows WGC recording so the existing recording pause control works when the app uses the Windows native helper.

What changed

  • Exposes native Windows pause/resume IPC calls through preload and renderer types.
  • Enables the pause control while a native Windows recording is active and tracks paused duration in the recorder hook.
  • Teaches the WGC helper to accept pause and resume commands, suspend video/audio output while paused, and compact encoded timestamps after resume.
  • Compacts editable cursor telemetry across native Windows paused ranges before writing cursor metadata.
  • Makes the Windows helper build prefer the real SDK um/x64 libraries before local compatibility libs so cursor-sampler links correctly on native Windows dev environments.

Validation

  • npm run build-vite
  • npm run build:native:win
  • npx biome check electron/electron-env.d.ts electron/ipc/handlers.ts electron/preload.ts src/hooks/useScreenRecorder.ts scripts/build-windows-wgc-helper.mjs

Summary by CodeRabbit

  • New Features

    • Pause and resume native Windows screen recordings — temporarily stop audio, video and cursor capture without ending the recording session.
  • Improvements

    • Pauses are tracked so timeline and recorded timestamps remain consistent across pause/resume.
    • Better handling when pausing/resuming to avoid dropped frames or hung stop sequences.
  • Bug Fixes

    • Surface pause/resume errors to the user via toast notifications.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d4970d38-c4be-41be-a5f1-bc3235dedd82

📥 Commits

Reviewing files that changed from the base of the PR and between ca826d9 and a50835e.

📒 Files selected for processing (2)
  • electron/native/wgc-capture/src/main.cpp
  • src/hooks/useScreenRecorder.ts

📝 Walkthrough

Walkthrough

This PR adds pause/resume functionality to Windows native screen recording across renderer APIs, React hooks, main-process IPC with cursor pause telemetry, native audio mixer pause gating, WGC capture synchronization, and Windows build helper updates.

Changes

Native Windows Recording Pause/Resume

Layer / File(s) Summary
Renderer-exposed pause/resume interface
electron/electron-env.d.ts, electron/preload.ts
Exposes pauseNativeWindowsRecording() and resumeNativeWindowsRecording() methods returning Promises with { success: boolean; error?: string } through the renderer bridge.
React hook pause/resume integration
src/hooks/useScreenRecorder.ts
useScreenRecorder now tracks paused state in native Windows recording handles, allows pausing during active native Windows capture, initializes paused:false on start, updates pause timing bookkeeping on toggle, and adjusts macOS webcam size fields to 0.
IPC handlers and cursor pause tracking
electron/ipc/handlers.ts
Adds pause-native-windows-recording and resume-native-windows-recording IPC handlers; tracks cursor pause start times, accumulated pause ranges, and paused state; implements completeNativeWindowsCursorPauseRange(); integrates tracking into start/stop/error flows and compacts cursor telemetry for write-out.
AudioMixer pause state and gating
electron/native/wgc-capture/src/audio_sample_utils.h, electron/native/wgc-capture/src/audio_sample_utils.cpp
Adds paused_ state and setPaused(bool) to AudioMixer; clears queued audio when pausing, drops incoming samples while paused, and updates mixer thread wait predicate to require not-paused before processing.
WGC capture pause/resume coordination
electron/native/wgc-capture/src/main.cpp
Introduces CaptureControl for stop/pause synchronization; replaces stdin stop-only loop with readCaptureCommands handling pause/resume and emitting JSON events; gates frame callback on pause; subtracts paused duration from encoded timestamps; rewires writer/encoder waits and shutdown to use unified control logic.
Windows SDK library path resolution
scripts/build-windows-wgc-helper.mjs
Adds findWindowsSdkUmLibDir() to detect latest Windows SDK um/x64 lib directory; conditionally prepends SDK lib path to LIB in generated .cmd and ensures gdiplus.lib is present when preparing compatibility libs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • siddharthvaddem
  • FabLrc

Poem

pause the frames, hush the mic, a tiny breather taken
timestamps shrink the sleeping seconds, nothing’s mistaken
cursor pauses logged like footprints in the snow ❄️
audio drains cleared—resume, and let the pixels flow 🎬
lowkey elegant, low-res caffeine-fueled code awaken

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly summarizes the main feature: adding pause/resume support to native Windows WGC recording, matching the primary objective of the changeset.
Description check ✅ Passed PR description covers the motivation, what changed, and validation steps. However, it doesn't follow the template structure with explicit sections like Description, Type of Change, or Related Issue(s).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@EtienneLescot EtienneLescot force-pushed the codex/fix-windows-paused-recording branch from f9ea0b2 to ca826d9 Compare May 22, 2026 19:02
@EtienneLescot EtienneLescot marked this pull request as ready for review May 22, 2026 19:03
…sed-recording

# Conflicts:
#	src/hooks/useScreenRecorder.ts
Copy link
Copy Markdown
Owner

@siddharthvaddem siddharthvaddem left a comment

Choose a reason for hiding this comment

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

LGTM — conflict resolved, lint/typecheck/tests green locally.

@siddharthvaddem siddharthvaddem merged commit b6b37e3 into main May 23, 2026
9 of 10 checks passed
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.

2 participants