Description
On Windows, my headphones (output device) turn off partway through a recording, even though I'm actively speaking into the microphone the whole time.
Root cause (traced through the code)
Windows audio capture lives in electron/native/wgc-capture/src/wasapi_loopback_capture.{h,cpp}. Both the microphone and system-audio paths open WASAPI capture streams:
- Mic:
WasapiLoopbackCapture::initializeMicrophone() → initialize(WasapiCaptureEndpoint::Microphone, ...) (wasapi_loopback_capture.cpp:222-265) opens a plain capture-mode IAudioClient on the default capture endpoint.
- System audio: same
initialize(), but for WasapiCaptureEndpoint::SystemLoopback it resolves the render endpoint (the headphones/speakers) and initializes it with AUDCLNT_STREAMFLAGS_LOOPBACK (wasapi_loopback_capture.cpp:247-255) — this reads what's already playing, it does not write to the device.
There is no IAudioRenderClient anywhere in the codebase, and no mic→speaker monitoring/passthrough. So the app never writes any PCM to the output device during a recording — it only ever reads from it via loopback capture.
Because the app never opens a render/playback stream on the output device, the render endpoint may look idle to Windows throughout the recording, even while mic capture and loopback capture are both running. That likely lets one of Windows' own power/priority controls on the device kick in and shut it off mid-recording.
I haven't pinned down which exact Windows setting is responsible — it's one of these (need to verify against the code path above):
- Device Manager → the device → Power Management tab → "Allow the computer to turn off this device to save power" (may also show as "Continue running on battery power" vs. "Disable automatically to save power" depending on Windows version/device).
- Sound settings → the device → Advanced/Properties → Exclusive Mode → "Allow applications to take exclusive control of this device" / "Give exclusive mode applications priority" — if some other app or the OS takes exclusive control, other endpoints can get suspended.
This is unrelated to the existing Linux/PipeWire "wrong headphone jack" device-selection bug referenced elsewhere in the code (#404) — that's about picking the wrong input device, not this Windows output-power/priority issue.
Workaround for now
Try disabling power-saving on the device in Device Manager (Power Management tab), and/or disabling exclusive-mode priority for other apps in the device's Advanced properties in Sound settings.
Proposed fix
Open a silent (or near-silent) WASAPI render stream on the same output device for the duration of the recording, alongside the existing loopback capture. Continuously writing to it — even silence — should keep Windows treating the endpoint as actively in use, regardless of which exact setting is currently causing the drop.
Environment
- Windows
- Recording with microphone enabled
I'd like to work on this — can I pick it up?
Description
On Windows, my headphones (output device) turn off partway through a recording, even though I'm actively speaking into the microphone the whole time.
Root cause (traced through the code)
Windows audio capture lives in
electron/native/wgc-capture/src/wasapi_loopback_capture.{h,cpp}. Both the microphone and system-audio paths open WASAPI capture streams:WasapiLoopbackCapture::initializeMicrophone()→initialize(WasapiCaptureEndpoint::Microphone, ...)(wasapi_loopback_capture.cpp:222-265) opens a plain capture-modeIAudioClienton the default capture endpoint.initialize(), but forWasapiCaptureEndpoint::SystemLoopbackit resolves the render endpoint (the headphones/speakers) and initializes it withAUDCLNT_STREAMFLAGS_LOOPBACK(wasapi_loopback_capture.cpp:247-255) — this reads what's already playing, it does not write to the device.There is no
IAudioRenderClientanywhere in the codebase, and no mic→speaker monitoring/passthrough. So the app never writes any PCM to the output device during a recording — it only ever reads from it via loopback capture.Because the app never opens a render/playback stream on the output device, the render endpoint may look idle to Windows throughout the recording, even while mic capture and loopback capture are both running. That likely lets one of Windows' own power/priority controls on the device kick in and shut it off mid-recording.
I haven't pinned down which exact Windows setting is responsible — it's one of these (need to verify against the code path above):
This is unrelated to the existing Linux/PipeWire "wrong headphone jack" device-selection bug referenced elsewhere in the code (#404) — that's about picking the wrong input device, not this Windows output-power/priority issue.
Workaround for now
Try disabling power-saving on the device in Device Manager (Power Management tab), and/or disabling exclusive-mode priority for other apps in the device's Advanced properties in Sound settings.
Proposed fix
Open a silent (or near-silent) WASAPI render stream on the same output device for the duration of the recording, alongside the existing loopback capture. Continuously writing to it — even silence — should keep Windows treating the endpoint as actively in use, regardless of which exact setting is currently causing the drop.
Environment
I'd like to work on this — can I pick it up?