Repository navigation
[Cocoa] Add a GPU process capture preview for WebKit's capture permission prompt - #78214
Open
eric-carlson wants to merge 1 commit into
Open
eric-carlson wants to merge 1 commit into
eric-carlson wants to merge 1 commit into
Conversation
Collaborator
|
EWS run on previous version of this PR (hash 934320c) Details
|
eric-carlson
force-pushed
the
capture-preview-gpu-process
branch
from
October 25, 2026 09:57
934320c to
e5722fa
Compare
Collaborator
|
EWS run on previous version of this PR (hash e5722fa) Details
|
Collaborator
iOS Safer C++ Build #62501 (e5722fa)❌ Found 1 failing file with 3 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming. |
…sion prompt https://bugs.webkit.org/show_bug.cgi?id=328783 rdar://190909434 Reviewed by NOBODY (OOPS!). Working toward adding a live camera preview and a microphone level meter to WebKit's getUserMedia permission prompt, so the user will be able see what they are about to share. This patch adds the GPU process code necessary for to be able to capture audio and/or video without an associated web process. The prompt itself will follow in a later change. - CapturePreviewManager captures from the chosen camera and microphone, hosts the camera frames in a layer the UI process can show, and reports the microphone level to the UI process. - GPUProcess::startCapturePreview and stopCapturePreview run one preview at a time. A preview sets the process-wide capture attribution, TCC identity and media environment for its page, so stopping it restores them to whichever page was capturing before. - GPUProcessProxy sends the camera, microphone and tccd sandbox extensions a preview needs. Unlike a granted capture's, they are revocable and are revoked when the preview stops. - RemoteAudioSessionProxyManager counts a running preview as recording, so the audio session has the record category before the capture unit starts. - Orientation monitoring counts capture and preview starts separately, and the start and stop messages say which with a RotationMonitoringReason. A preview stopping must not stop monitoring a camera that a capture still uses, and the reverse. * Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h: Export setPreferredMicrophoneID. * Source/WebKit/CMakeLists.txt: * Source/WebKit/DerivedSources-input.xcfilelist: * Source/WebKit/DerivedSources.make: * Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::reapplyCaptureEnvironment): (WebKit::GPUConnectionToWebProcess::startMonitoringCaptureDeviceRotation): (WebKit::GPUConnectionToWebProcess::stopMonitoringCaptureDeviceRotation): * Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h: * Source/WebKit/GPUProcess/GPUProcess.cpp: (WebKit::GPUProcess::startCapturePreview): (WebKit::GPUProcess::stopCapturePreview): (WebKit::GPUProcess::stopCapturePreviewManager): (WebKit::GPUProcess::didApplyCaptureEnvironment): * Source/WebKit/GPUProcess/GPUProcess.h: * Source/WebKit/GPUProcess/GPUProcess.messages.in: * Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm: (WebKit::GPUConnectionToWebProcess::setCaptureAttributionString): (WebKit::GPUConnectionToWebProcess::setTCCIdentity): * Source/WebKit/GPUProcess/cocoa/GPUProcessCocoa.mm: (WebKit::GPUProcess::setCaptureTCCIdentity): * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp: (WebKit::RemoteAudioSessionProxyManager::hasActiveProxy): (WebKit::RemoteAudioSessionProxyManager::beginCapturePreview): (WebKit::RemoteAudioSessionProxyManager::endCapturePreview): (WebKit::RemoteAudioSessionProxyManager::updateCategory): (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess): * Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.h: * Source/WebKit/GPUProcess/webrtc/CapturePreviewManager.h: Added. * Source/WebKit/GPUProcess/webrtc/CapturePreviewManager.mm: Added. * Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.mm: Import Logging.h, which an earlier file in its unified source bundle used to provide. * Source/WebKit/GPUProcess/webrtc/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::startProducingData): (WebKit::UserMediaCaptureManagerProxy::applyCaptureEnvironment): (WebKit::UserMediaCaptureManagerProxy::reapplyCaptureEnvironment): * Source/WebKit/GPUProcess/webrtc/UserMediaCaptureManagerProxy.h: * Source/WebKit/Shared/RotationMonitoringReason.h: Added. * Source/WebKit/Shared/RotationMonitoringReason.serialization.in: Added. * Source/WebKit/SourcesCocoa.txt: * Source/WebKit/UIProcess/Cocoa/UserMediaPermissionRequestManagerProxy.mm: (-[WKRotationCoordinatorObserver start:layer:reason:]): (-[WKRotationCoordinatorObserver stop:reason:]): (-[WKRotationCoordinatorObserver stopAllForCapturePreview]): (WebKit::UserMediaPermissionRequestManagerProxy::startMonitoringCaptureDeviceRotation): (WebKit::UserMediaPermissionRequestManagerProxy::stopMonitoringCaptureDeviceRotation): (WebKit::UserMediaPermissionRequestManagerProxy::stopMonitoringCaptureDeviceRotationForCapturePreview): * Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp: (WebKit::GPUProcessProxy::startMonitoringCaptureDeviceRotation): (WebKit::GPUProcessProxy::stopMonitoringCaptureDeviceRotation): (WebKit::GPUProcessProxy::startCapturePreview): (WebKit::GPUProcessProxy::capturePreviewAudioLevelChanged): (WebKit::GPUProcessProxy::stopCapturePreview): * Source/WebKit/UIProcess/GPU/GPUProcessProxy.h: (WebKit::GPUProcessProxy::setCapturePreviewAudioLevelHandler): * Source/WebKit/UIProcess/GPU/GPUProcessProxy.messages.in: * Source/WebKit/UIProcess/UserMediaPermissionRequestManagerProxy.h: * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::startMonitoringCaptureDeviceRotation): (WebKit::WebPageProxy::stopMonitoringCaptureDeviceRotation): (WebKit::WebPageProxy::stopMonitoringCaptureDeviceRotationForCapturePreview): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/WebKit.xcodeproj/project.pbxproj:
eric-carlson
force-pushed
the
capture-preview-gpu-process
branch
from
October 25, 2026 19:30
e5722fa to
c6a0807
Compare
Collaborator
|
EWS run on current version of this PR (hash c6a0807) Details
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧪 api-mac-cmake-debug
934320c
c6a0807