fix: keep Windows audio capture alive after transient WASAPI errors#635
fix: keep Windows audio capture alive after transient WASAPI errors#635Treasure520520 wants to merge 1 commit into
Conversation
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughAudio capture now classifies certain WASAPI buffer errors as recoverable, counts and bounds recoverable warnings per session, continues capture on recoverable failures, exposes a ChangesRecoverable WASAPI Error Handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Adding a little more context because this PR touches native capture code. The symptom in #629 is consistent with the audio capture thread stopping or no longer writing after a transient WASAPI failure while the WGC video path keeps running. In This patch only treats Suggested Windows validation:
|
|
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@electron/native/wgc-capture/src/wasapi_loopback.cpp`:
- Around line 443-450: The fatal-error branches in the WASAPI loop currently set
capturing_ = false which prevents WasapiCapture::stop() from joining thread_ and
finalizing the WAV header/handles; instead introduce a separate fatal latch
(e.g. atomic<bool> fatal_error_ or fatal_failure_) and set that in the
captureClient_->GetBuffer(...) and captureClient_->GetNextPacketSize(...) fatal
branches, leaving capturing_ unchanged so stop() will still run its cleanup/join
logic, or alternatively modify WasapiCapture::stop() to always join thread_ and
finalize resources even when capturing_ is false; update the loop to break on
fatal_error_ and adjust any checks that rely on capturing_ accordingly
(reference symbols: capturing_, fatal_error_ (new), WasapiCapture::stop(),
captureClient_->GetBuffer, captureClient_->GetNextPacketSize, thread_, WAV
header/handle).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8da997e4-b072-446e-b0e8-666a32d0f444
📒 Files selected for processing (3)
electron/native/wgc-capture/src/main.cppelectron/native/wgc-capture/src/wasapi_loopback.cppelectron/native/wgc-capture/src/wasapi_loopback.h
37546a5 to
fd1d9eb
Compare
|
|
1 similar comment
|
|
|
Follow-up from review:
|
Fixes #629
This targets the Windows recordings where audio can be present for the first few seconds and then disappear while video continues recording.
What changed:
AUDCLNT_E_BUFFER_ERRORcapture failures as recoverable instead of letting the audio capture path go silent/stale.recoverableWasapiErrorCountto companion audio timing metadata and stderr diagnostics so future reports can confirm whether recovery happened during the recording.Validation:
npm test -- electron/ipc/recording/windowsFallbacks.test.ts electron/ipc/recording/diagnostics.test.tsnpm run build:windows-captureon macOS confirms the project script skips Windows helper builds off Windows. The native helper still needs a Windows build/recording check in CI or on a Windows machine.Bounty note: this PR is submitted for the $50 bounty mentioned in #629.
Summary by CodeRabbit