Skip to content

fix(macos): resolve Chromium USB microphone labels - #648

Merged
EtienneLescot merged 1 commit into
getopenscreen:mainfrom
Crnobog9527:fix/macos-microphone-device-label
Sep 13, 2026
Merged

fix(macos): resolve Chromium USB microphone labels#648
EtienneLescot merged 1 commit into
getopenscreen:mainfrom
Crnobog9527:fix/macos-microphone-device-label

Conversation

@Crnobog9527

@Crnobog9527 Crnobog9527 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Selecting a USB microphone in the macOS HUD can fail to select that microphone for native recording: Chromium reports Shure MV7 (14ed:1012), while AVFoundation reports Shure MV7. The renderer forwards the decorated label and a Chromium device ID, so neither the existing exact-name lookup nor the native-ID lookup resolves it. Device preview can work while native capture falls back to the system default.

Resolve a valid native ID first, then an exact name, then a unique name after removing only a trailing USB VID:PID suffix. Preserve exact decorated names, reject ambiguous name matches, and leave the existing unresolved-device warning/default behavior intact. Add six Swift regression tests in the capture core.

Related issue

Reported during local use of v1.11.0 on macOS 26.6.2 with a Shure MV7. Changing the system default input to MV7 restored recording. No existing issue is being closed. This PR addresses device selection; it does not claim to fix all causes of silent system audio.

Type of change

  • Bug fix

Release impact

  • Patch

Desktop impact

  • macOS

Screenshots / video

No visual changes. Local desktop recordings are not attached because they contain private workspace content.

Testing

  • swift test --package-path electron/native/screencapturekit: 31 passed, including 6 new resolver tests.
  • swift build -c release --package-path electron/native/screencapturekit: passed for both helpers.
  • npm run test: 226 files passed; 2,764 tests passed, 1 skipped. An initial run while Electron was unavailable failed to load 8 suites; after installing the official Electron 41.2.1 runtime, the full rerun passed.
  • Both npx tsc --noEmit and npx tsc -p tsconfig.test.json --noEmit: passed.
  • npm run lint:fix: no errors or edits; existing warnings remain.
  • npm run docs:check and git diff --check: passed.
  • Real AVFoundation enumeration on the Mac: the new resolver maps the Chromium MV7 label to the actual MV7 native ID.
  • Desktop smoke via native mouse/keyboard on the dev build with rebuilt release helper: selected explicit MV7, mic on/system audio off, recorded 16.1 seconds, stopped, and reached saved editor. Raw audio is non-silent (mean -37.4 dBFS, peak -13.3 dBFS). Recorded in the manual checklist log.

Limits: system default was also MV7 during the smoke test, so the audio test alone does not demonstrate non-default routing; the direct resolver check covers identity. Listening, non-default-input recording, combined/system audio, export and other platforms were not tested. Local JS checks used Node 24.14.0/npm 11.9.0; upstream CI uses the pinned runtime. Installed official app was not modified.

Summary by CodeRabbit

  • Bug Fixes

    • Improved microphone selection when using device IDs or exact microphone names.
    • Supports matching microphones with trimmed names and common vendor/product labels.
    • Prevents incorrect selection when multiple microphones share the same name.
  • Documentation

    • Added macOS Apple Silicon validation results covering microphone selection, recording, editor saving, and audio output.

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 05f54317-f8e5-498a-8ae1-7e0091a15542

📥 Commits

Reviewing files that changed from the base of the PR and between 6862a38 and 43b7cc3.

📒 Files selected for processing (4)
  • electron/native/screencapturekit/Sources/OpenScreenCaptureCore/MicrophoneDeviceSelection.swift
  • electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/ScreenCaptureRecorder.swift
  • electron/native/screencapturekit/Tests/OpenScreenCaptureCoreTests/MicrophoneDeviceSelectionTests.swift
  • technical-documentation/testing/manual-e2e-checklist.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds shared microphone device resolution, uses it during ScreenCaptureKit recording, adds XCTest coverage, and records partial macOS manual validation for explicit microphone selection.

Changes

Microphone resolution

Layer / File(s) Summary
Resolver rules and automated coverage
electron/native/screencapturekit/Sources/OpenScreenCaptureCore/MicrophoneDeviceSelection.swift, electron/native/screencapturekit/Tests/OpenScreenCaptureCoreTests/MicrophoneDeviceSelectionTests.swift
Adds resolveMicrophoneDeviceID with exact ID, exact name, ambiguity, and vendor/product suffix handling. Tests cover these resolution cases.
Capture integration and validation
electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/ScreenCaptureRecorder.swift, technical-documentation/testing/manual-e2e-checklist.md
Routes capture device resolution through the shared helper. Records partial macOS Apple Silicon validation for explicit Shure MV7 capture and saved output.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ScreenCaptureRecorder
  participant AVCaptureDevice
  participant resolveMicrophoneDeviceID
  ScreenCaptureRecorder->>AVCaptureDevice: list audio devices
  AVCaptureDevice-->>ScreenCaptureRecorder: uniqueID and localizedName
  ScreenCaptureRecorder->>resolveMicrophoneDeviceID: microphone ID, name, mapped devices
  resolveMicrophoneDeviceID-->>ScreenCaptureRecorder: resolved microphone ID or nil
Loading

Merge Risk: ⚪ Minimal · up to 43b7c

The explicit USB microphone selection path has no identified merge-blocking issue.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and concisely identifies the macOS Chromium USB microphone label-resolution fix.
Description check ✅ Passed The description includes all required sections. It clearly explains the bug, implementation, scope, platform impact, release impact, testing, and validation limits.
Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@EtienneLescot
EtienneLescot merged commit 13e3a38 into getopenscreen:main Sep 13, 2026
20 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