Skip to content

fix: address upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS). - #49740

Merged
codebytere merged 3 commits into
39-x-yfrom
trop/39-x-y-bp-fix-address-upstream-chromium-shift-to-enable-coreaudio-tap-api-for-audio-capture-used-in-electron-s-desktopcapturer-macos--1770732391656
Feb 11, 2026
Merged

codebytere merged 3 commits into
39-x-yfrom
trop/39-x-y-bp-fix-address-upstream-chromium-shift-to-enable-coreaudio-tap-api-for-audio-capture-used-in-electron-s-desktopcapturer-macos--1770732391656

Conversation

@trop

@trop trop Bot commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Backport of #49717

See that PR for details.

Notes: Addressed upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS).

@trop
trop Bot requested a review from a team as a code owner February 10, 2026 14:06
@trop trop Bot added 39-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Feb 10, 2026
@codebytere
codebytere merged commit 0aba4a6 into 39-x-y Feb 11, 2026
66 checks passed
@codebytere
codebytere deleted the trop/39-x-y-bp-fix-address-upstream-chromium-shift-to-enable-coreaudio-tap-api-for-audio-capture-used-in-electron-s-desktopcapturer-macos--1770732391656 branch February 11, 2026 10:05
@release-clerk

release-clerk Bot commented Feb 11, 2026

Copy link
Copy Markdown

Release Notes Persisted

Addressed upstream Chromium shift to enable CoreAudio Tap API for audio capture used in electron's desktopCapturer (🍏 macOS).

csett86 added a commit to jitsi/jitsi-meet-electron that referenced this pull request Feb 13, 2026
With electron/electron#49717 the desktopCapturer
supports system audio for macOS 13 and above. Is was recently fixed
in electron/electron#49740 for current
electron.

This is a preparational step, but:

This on its own does not allow audio for screenshare, as its currently
hard-coded to only show the "Share Audio" button on windows, see
https://github.com/jitsi/jitsi-meet/blob/master/react/features/screen-share/functions.ts#L34
akhmialeuski added a commit to akhmialeuski/advanced-audio-recorder that referenced this pull request Oct 23, 2026
…ctron 39

The macOS grant passed every Electron from 39.0, but the CoreAudio tap
Chromium uses from 39.0 also needs NSAudioCaptureUsageDescription in the
app's Info.plist, which Electron's default Info.plist carries only from
39.6.0 (electron/electron#49740). The Obsidian 1.11.4 installer, built on
Electron 39.2.6, lacks the key, so it was granted, handed back an ended
track, and told the user to allow a permission that cannot help.

Raise the floor to 39.6, so that installer gets the refusal that names the
current installer. Electron 40.0 to 40.4 lack the key too, and no Obsidian
installer was built on them.
akhmialeuski added a commit to akhmialeuski/advanced-audio-recorder that referenced this pull request Oct 23, 2026
…n 39.6+ (#138)

## What changes and why

A Mac user can now record the other side of a call with **Include system
audio** or a **System audio (this computer)** track, on macOS 14.2 or
later in an Obsidian installer built on Electron 39.6 or later, without
BlackHole and a Multi-Output device. Until now one platform check in
`loopbackHost()` (`process.platform !== 'win32'`) refused it with
"Recording the system output directly is granted on Windows only",
although the capture path (`setDisplayMediaRequestHandler` with `audio:
'loopback'` plus `desktopCapturer`) works on a current Mac, as the
reporter verified on macOS 27 with Electron 43. Closes
[#137](#137).

Chromium captures a Mac's output through Apple's CoreAudio tap, which
arrived in macOS 14.2 and became the default in Electron 39
([electron/electron#49717](electron/electron#49717),
and the maintainer's answer in
[electron/electron#47490](electron/electron#47490)).
The tap also needs the `NSAudioCaptureUsageDescription` key in the app's
`Info.plist`, which Electron's default `Info.plist` carries only from
v39.6.0
([electron/electron#49740](electron/electron#49740)).
Without the System Audio Recording permission the grant still returns an
audio track, created already `ended` and never delivering a sample, with
no error raised. Without the Screen Recording permission
`desktopCapturer.getSources` rejects with "Failed to get sources", which
is what the issue reports.

## Changes

Functional:

- `grantPlatform()` and `macRefusal()` in
`src/recording/systemAudioSupport.ts` grant `darwin` when the host
reports macOS 14.2 or later (`process.getSystemVersion()`) and Electron
39.6 or later. A Mac below either floor, or one that reports no version,
is refused before the host is asked, so the user never sees the
screen-recording prompt only to record silence. The refusal names the
version that falls short and, for Electron, points to the installer,
because Obsidian's in-app updates do not replace it.
- `leadingVersion()` compares the first two numbers as numbers, so
`14.10` passes the 14.2 floor and a pre-release such as `43.0.0-beta.4`
passes 39.6.
- On a Mac, five failures send the user to System Settings > Privacy &
Security > Screen & System Audio Recording (Screen Recording on macOS
14), adding Obsidian with the + button if it is not listed, then
quitting and reopening Obsidian, and offer BlackHole instead of Stereo
Mix or VB-CABLE: a refused source list, no screen, `NotAllowedError`, no
audio track, and an audio track that arrives already ended.
- The + button is in the step because macOS may never prompt on this
path: Electron raises no permission prompt for a source the app picks
itself rather than through the system picker
([electron/electron#52738](electron/electron#52738)),
so Obsidian can be missing from the list.
- `audioOnly()` reads the audio track's state before stopping the video
track, so a track that arrived ended (the macOS permission symptom) is
told apart from one the video stop took down with it.
- `isSystemAudioLoopbackAvailable()` is replaced by
`systemAudioGrantSupport()`, which returns `{ refusal, permission }`
from one probe of the host. The Windows wording is unchanged, except the
answer with no audio track, which no longer says "elsewhere".
- The **Include system audio** and **Track N source** rows show the
refusal word for word, as a refused recording would end, and show the
macOS permission where the grant is available.
- System info gains `osVersion`, read by the new `hostSystemVersion()`
in `src/platform/hostProcess.ts`, and `systemAudioLoopbackRefusal`.
- `docs/use-cases/meeting-notes-workflow.md` covers the macOS route: the
permission step with the + button, the version floors, a checklist item
and two troubleshooting entries. `docs/troubleshooting.md` gains a "This
computer's output is not recorded" section with one entry per refusal
reason. `docs/recording.md`, `docs/multi-track-recording.md`,
`docs/settings-reference.md`, `docs/features.md`, `docs/index.md` and
`README.md` say the same. Release notes are left to the release PR, per
`docs/dev/releasing.md`.

Tests:

- `tests/unit/systemAudioSupport.test.ts` covers granted Macs (the floor
itself, the reporter's machine, `14.10`, a bare `26`, `43.0.0-beta.4`),
refused Macs (macOS 14.1, 13.x, a missing or empty version, Electron
39.5.2, the Electron 39.2.6 of the Obsidian 1.11.4 installer, Electron
38, a missing or invalid Electron, both too old, a throwing
`getSystemVersion`), all refused before `getDisplayMedia` or the handler
is touched, and the five Mac permission failures with the + button step,
the BlackHole fallback, and an ended-on-arrival track against one ended
with the video on both platforms.
- `tests/integration/settingsDefinitions.test.ts` covers the macOS
permission on both rows, the version reason on an old Mac, no permission
text on Windows, and the Linux refusal.
- `tests/integration/SystemDiagnostics.test.ts` covers `osVersion` and
the refusal reason or null, and `tests/unit/hostProcess.test.ts` covers
`hostSystemVersion` absent, empty, throwing and with no process.

## Verification

The local gate on
[cb5fa63](cb5fa63)
is green. `npm run build` passes, and `npm run lint` reports 0 errors
and the 2 existing warnings. `npm run test:coverage -- --randomize`
(seed 483263896) passes 7759 of 7759 tests in 325 suites. An earlier run
of the same tree (seed -310868346) timed out once in
`tests/e2e/recordingPanel.e2e.test.ts`, whose test takes 52 ms alone and
passes with that seed. `coverage-diff` finds no regression, with total
branches at 96.35% against a baseline of 96.22%. `layer-check`,
`test-conventions` and `clone-check` stay within their ceilings.

The settings rows were rendered from a dump of the real settings tab. On
Windows the **Include system audio** and **Track N source** text is
unchanged, so `docs/images/settings-audio-input.png`,
`settings-include-system-audio.png` and `settings-multi-track.png` still
show the current rows and are not replaced.

Nothing has run on a real Mac. Every macOS case runs against a mocked
`process`, `desktopCapturer` and `getDisplayMedia`. The issue author
offered to test a build on macOS before the release, which would confirm
the permission messages, the version floors, and whether Obsidian
appears in the permission list on its own.

## Risks and what to review first

- The Electron floor is 39.6, the first 39.x whose `Info.plist` carries
`NSAudioCaptureUsageDescription`. The Obsidian 1.11.4 installer runs
Electron 39.2.6, and its DMG holds `NSMicrophoneUsageDescription` but no
`NSAudioCaptureUsageDescription`, while the 1.12.4 installer on Electron
39.7.0 holds both, so 1.11.4 is refused with the installer advice
instead of being sent to a permission that cannot help. Electron 40.0 to
40.4 lack the key too and would pass the floor, but no Obsidian
installer was built on them: the changelog lists 39.2.6, 39.7.0, 39.8.3
and then 43.x.
-
[electron/electron#52738](electron/electron#52738)
is open and describes exactly this call path (`useSystemPicker: false`):
the track arrives ended and macOS shows no prompt. The plugin handles it
by naming the permission and the + button, and the reporter of
[#137](#137)
recorded successfully after granting it by hand, but a fix in Electron
could change what macOS does on this path.
- `systemAudioGrantSupport()` replaces an exported function, and every
caller in `src/` was moved to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

39-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant