[webkit-changes] [WebKit/WebKit] db99ef: setCameraActive should not unmute microphone if UA...
youennf
noreply at github.com
Thu Sep 19 14:38:23 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: db99ef7168d75ef952c1b85b0b88feb72c9c91ad
https://github.com/WebKit/WebKit/commit/db99ef7168d75ef952c1b85b0b88feb72c9c91ad
Author: Youenn Fablet <youenn at apple.com>
Date: 2024-09-19 (Thu, 19 Sep 2024)
Changed paths:
M Source/WebCore/page/MediaProducer.h
M Source/WebKit/UIProcess/API/C/WKPage.cpp
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm
Log Message:
-----------
setCameraActive should not unmute microphone if UA previously muted both camera and microphone
rdar://136221456
https://bugs.webkit.org/show_bug.cgi?id=279889
Reviewed by Eric Carlson.
When trying to unmute capture via setCameraActive/setMicrophoneActive a capture that was muted by the UA,
we would unmute both microphone and camera at the same time.
This is probably not great for the user.
For that reason, we now store in WebPageProxy whether the web page would like to have capture muted (for each capture type).
This new state, called m_mutedCaptureKindsDesiredByWebApp, can be changed in two ways:
- this state can be set to muted whenever UA decides so (WKWebView user).
- this state can be set to muted/unmuted via setCameraActive/setMicrophoneActive if successful.
The muted state sent to WebPage in WebPageProxy::setMuted is updated according m_mutedCaptureKindsDesiredByWebApp.
This allows to not restart microphone capture if the web app only asked to restart camera capture.
Note that m_mutedCaptureKindsDesiredByWebApp is only used to further mute capture (and not unmute capture).
Covered by added and updated API tests.
* Source/WebCore/page/MediaProducer.h:
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageSetMuted):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView setMicrophoneCaptureState:completionHandler:]):
(-[WKWebView setCameraCaptureState:completionHandler:]):
(-[WKWebView _setPageMuted:]):
(-[WKWebView _setDisplayCaptureState:completionHandler:]):
(-[WKWebView _setSystemAudioCaptureState:completionHandler:]):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::applyWebAppDesiredMutedKinds):
(WebKit::updateMutedCaptureKindsDesiredByWebApp):
(WebKit::WebPageProxy::setMuted):
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::willStartCapture):
(WebKit::WebPageProxy::validateCaptureStateUpdate):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
(TestWebKitAPI::(WebKit2, ToggleCameraCaptureWhenRestarting)):
(TestWebKitAPI::(WebKit2, ToggleMicrophoneCaptureWhenRestarting)):
(TestWebKitAPI::(WebKit2, ToggleCaptureWhenRestarting)): Deleted.
Canonical link: https://commits.webkit.org/283948@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