[webkit-changes] [WebKit/WebKit] 277f12: Add support for AirPods mute API
youennf
noreply at github.com
Mon Sep 23 17:30:46 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 277f1203fdad2dce4ff1af259a0bc9b1ac6bad06
https://github.com/WebKit/WebKit/commit/277f1203fdad2dce4ff1af259a0bc9b1ac6bad06
Author: Youenn Fablet <youenn at apple.com>
Date: 2024-09-23 (Mon, 23 Sep 2024)
Changed paths:
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WTF/wtf/PlatformHave.h
M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
A Source/WebCore/PAL/pal/cocoa/AVFAudioSoftLink.h
A Source/WebCore/PAL/pal/cocoa/AVFAudioSoftLink.mm
M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp
M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.h
M Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.mm
M Source/WebKit/GPUProcess/GPUProcess.cpp
M Source/WebKit/GPUProcess/GPUProcess.h
M Source/WebKit/GPUProcess/GPUProcess.messages.in
M Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp
M Source/WebKit/UIProcess/GPU/GPUProcessProxy.h
M Source/WebKit/UIProcess/GPU/GPUProcessProxy.messages.in
M Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
Log Message:
-----------
Add support for AirPods mute API
rdar://135545311
https://bugs.webkit.org/show_bug.cgi?id=279358
Reviewed by Eric Carlson.
We introduce a web preference called UseMicrophoneMuteStatusAPI to control this feature.
When it is on and we are capturing microphone, we register listeners to AirPods mute notifications.
This allows to mute/unmute microphone when user presses AirPods stems.
To implement this, we register for the listeners in the GPUProcess via CoreAudioSharedUnit.
On mute/unmute notification, we send an IPC message to GPUProcessProxy.
GPUProcessProxy selects the web page that should process the notification (currently, it is the last microphone capturing web page).
The web page will then toggle the microphone muted state according the notification.
This will in turn instruct the GPUProcess via the WebProcess to mute capture which is needed on macOS.
On iOS, microphone is muted by the system directly, on macOS this is done via kAUVoiceIOProperty_MuteOutput.
This patch needs https://bugs.webkit.org/show_bug.cgi?id=279515 so that, when muting, we keep the audio unit to be able to recveive the unmute notifications.
Manually tested on macOS and iOS.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/cocoa/AVFAudioSoftLink.h: Added.
* Source/WebCore/PAL/pal/cocoa/AVFAudioSoftLink.mm: Added.
* Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.cpp:
(WebCore::CoreAudioSharedUnit::~CoreAudioSharedUnit):
(WebCore::CoreAudioSharedUnit::handleMuteStatusChangedNotification):
* Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.h:
* Source/WebCore/platform/mediastream/mac/CoreAudioSharedUnit.mm:
(-[WebCoreAudioInputMuteChangeListener start]):
(-[WebCoreAudioInputMuteChangeListener stop]):
(-[WebCoreAudioInputMuteChangeListener handleMuteStatusChangedNotification:]):
(WebCore::getSharedAVAudioApplication):
(WebCore::setNoopInputMuteStateChangeHandler):
(WebCore::registerAudioInputMuteChangeListener):
(WebCore::unregisterAudioInputMuteChangeListener):
(WebCore::CoreAudioSharedUnit::setMuteStatusChangedCallback):
* Source/WebKit/GPUProcess/GPUProcess.cpp:
(WebKit::GPUProcess::enableMicrophoneMuteStatusAPI):
* Source/WebKit/GPUProcess/GPUProcess.h:
* Source/WebKit/GPUProcess/GPUProcess.messages.in:
* Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::enableMicrophoneMuteStatusAPI):
(WebKit::GPUProcessProxy::updateCaptureAccess):
(WebKit::GPUProcessProxy::setMicrophoneMuteStatusChanged):
* Source/WebKit/UIProcess/GPU/GPUProcessProxy.h:
* Source/WebKit/UIProcess/GPU/GPUProcessProxy.messages.in:
* Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::syncWithWebCorePrefs const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setMuted):
(WebKit::WebPageProxy::willStartCapture):
(WebKit::WebPageProxy::setMicrophoneMuteStatusChanged):
(WebKit::WebPageProxy::gpuProcessExited):
* Source/WebKit/UIProcess/WebPageProxy.h:
Canonical link: https://commits.webkit.org/284123@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list