Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(windows): let the default microphone id veto the device name

EtienneLescot42d15e67cdbe
diff --git a/electron/native/wgc-capture/src/wasapi_loopback_capture.cpp b/electron/native/wgc-capture/src/wasapi_loopback_capture.cpp
index 49239ad01..c19c44160 100644
--- a/electron/native/wgc-capture/src/wasapi_loopback_capture.cpp
+++ b/electron/native/wgc-capture/src/wasapi_loopback_capture.cpp
@@ -203,9 +203,15 @@ bool WasapiLoopbackCapture::initialize(WasapiCaptureEndpoint endpoint, const std
// resolve one in time, but a name that simply matches no endpoint lands
// in exactly the same place. Either way the take sounds like the wrong
// microphone with nothing explaining why (getopenscreen/openscreen#404).
+ // "default" vetoes the name, it does not merely sit beside it. The picker
+ // persists BOTH fields from whichever entry was clicked, and Chromium's own
+ // Default entry carries the label "Default - Microphone (…)" — a string no
+ // endpoint FriendlyName ever matches. Reading the name as an alternative
+ // therefore warned about a microphone the user never chose, every time they
+ // picked Default explicitly instead of leaving the picker alone.
const bool wantedAParticularMicrophone =
- endpoint == WasapiCaptureEndpoint::Microphone &&
- ((!deviceId.empty() && deviceId != L"default") || !deviceName.empty());
+ endpoint == WasapiCaptureEndpoint::Microphone && deviceId != L"default" &&
+ (!deviceId.empty() || !deviceName.empty());
if (wantedAParticularMicrophone) {
std::cerr << "{\"event\":\"warning\",\"code\":\"microphone-defaulted\","
"\"message\":\"The requested microphone could not be resolved; "