Skip to content

fix(audio): start the macOS system-audio tap after the microphone - #1374

Merged
EtienneLescot merged 1 commit into
getopenscreen:mainfrom
marcgabe15:fix/mac-mic-silent-with-system-audio
Oct 24, 2026
Merged

EtienneLescot merged 1 commit into
getopenscreen:mainfrom
marcgabe15:fix/mac-mic-silent-with-system-audio

Conversation

@marcgabe15

@marcgabe15 marcgabe15 commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

On an idle Mac the Core Audio tap's aggregate device does not run until another app plays a sound. A picker take started the tap before its SCStream, and while the tap sat stalled ScreenCaptureKit delivered no microphone audio either, so the microphone was silent until the first sound (#1173).

A take with a microphone now starts its tap on the first microphone buffer, with a one-second fallback for a microphone that never delivers; a take without one starts it right after the stream. The tap is owned by the sample queue, so its start and stop cannot race.

Related issue

Fixes #1173

Type of change

  • Bug fix
  • Feature
  • Enhancement
  • Documentation
  • Refactor / maintenance
  • Performance
  • Security

Release impact

  • Patch
  • Minor
  • Major / breaking change
  • No release note needed

Desktop impact

  • Windows
  • macOS
  • Linux
  • Installer / packaging
  • Not platform-specific

Screenshots / video

Testing

  • Manual e2e test with external and normal mic from mac ARM

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of system-audio capture during screen recordings that also use a microphone, including when the output device is idle.

On an idle Mac the Core Audio tap's aggregate device does not run until
another app plays a sound. A picker take started the tap before its
SCStream, and while the tap sat stalled ScreenCaptureKit delivered no
microphone audio either, so the microphone was silent until the first
sound (getopenscreen#1173).

A take with a microphone now starts its tap on the first microphone
buffer, with a one-second fallback for a microphone that never delivers;
a take without one starts it right after the stream. The tap is owned by
the sample queue, so its start and stop cannot race.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fa609353-8a9d-46ca-a4ee-a6379db7b15c
📥 Commits

Reviewing files that changed from the base of the PR and between 264975d and 8ae0091.

📒 Files selected for processing: 2
  • electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/ScreenCaptureRecorder.swift
  • technical-documentation/testing/manual-e2e-checklist.md

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

📝 Walkthrough

The recorder now starts the system-audio tap after the capture stream starts when microphone capture is disabled. When microphone capture is enabled, it starts the tap on microphone output or after a one-second fallback deadline. Shutdown disables tapped-audio acceptance and clears the stored tap.

Changes: macOS microphone and system-audio capture

Layer / File(s) Summary
Schedule, start, and stop the system-audio tap
electron/native/screencapturekit/Sources/OpenScreenScreenCaptureKitHelper/ScreenCaptureRecorder.swift, technical-documentation/testing/manual-e2e-checklist.md
The recorder defers tap startup until the capture stream starts, microphone output arrives, or the fallback deadline passes. Startup checks that tapped audio is accepted and no tap exists. Shutdown disables acceptance and clears the stored tap. The checklist adds an idle-output capture check and a results entry documenting the tested setup and observations.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 8ae00

No established merge-blocking issue remains. The reported manual tests cover the microphone fix, though they do not establish behavior for every microphone.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 1 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: the macOS system-audio tap now starts after the microphone rather than before it. It matches the Swift recorder change and the PR objective to fix silent microphone ca…
Description check Passed The description has a clear summary of the problem and fix, and it links issue #1173. It marks the type (Bug fix), release impact (Patch), and desktop impact (macOS), and it gives a brief manual test …
Linked Issues check Passed Issue #1173 requires the selected microphone to capture from recording start without a system sound. In ScreenCaptureRecorder.swift, picker-based system-audio tap startup now occurs after `stream.st…
Out of Scope Changes check Passed The changes stay within issue #1173. The Swift changes adjust picker-based macOS tap timing and serialized tap shutdown. The checklist item and results-log entry document the related idle-output micro…
Full details: Title check

Explanation

The title names the main change: the macOS system-audio tap now starts after the microphone rather than before it. It matches the Swift recorder change and the PR objective to fix silent microphone capture on idle Macs. The title follows the conventional fix(scope) form, is one sentence, and is specific.

Full details: Description check

Explanation

The description has a clear summary of the problem and fix, and it links issue #1173. It marks the type (Bug fix), release impact (Patch), and desktop impact (macOS), and it gives a brief manual test note. Gaps: the template's Summary heading is missing, the 'Fixes #' line is filled in, and the Testing section is short. It lacks the commands or steps, OS version, and test conditions that the template asks for. The untested cases are not described. The Screenshots section is left as the placeholder comment, which is acceptable for a non-UI change.

Resolution

Optionally add a '## Summary' heading above the description text. In '## Testing', list the macOS version, the microphone models tested, and the steps used (for example, a recording with the output device idle). Also note any cases not tested, such as a take without a microphone.

Full details: Linked Issues check

Explanation

Issue #1173 requires the selected microphone to capture from recording start without a system sound. In ScreenCaptureRecorder.swift, picker-based system-audio tap startup now occurs after stream.startCapture(). When microphone capture is enabled, the tap starts on the first microphone buffer. A one-second ticker fallback starts it when no microphone buffer arrives. The microphone buffer is still ingested through the existing mixer path. The documented macOS 26.6.2 manual results report microphone audio from 0.18 s and a mid-take system sound in the take.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #1173. The Swift changes adjust picker-based macOS tap timing and serialized tap shutdown. The checklist item and results-log entry document the related idle-output microphone scenario. No unrelated product behavior or unrelated platform changes are present in the reviewed diff.

Full details: Docstring Coverage

Explanation

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

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 LanguageTool
technical-documentation/testing/manual-e2e-checklist.md

LanguageTool checks are incomplete because the per-file request limit of 5 was reached. Remaining text was skipped; findings from completed checks are retained.

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.

@marcgabe15

Copy link
Copy Markdown
Collaborator Author

This should be ready for review @EtienneLescot

@EtienneLescot
EtienneLescot merged commit da6496e into getopenscreen:main Oct 24, 2026
20 checks passed
@EtienneLescot

Copy link
Copy Markdown
Member

Thanks a lot @marcgabe15, this is a clean fix for a long-standing one. Merged!

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.

[Bug]: macOS: microphone recording only starts after a system sound is played

2 participants