Changeset 271640 in webkit
- Timestamp:
- Jan 20, 2021 12:57:03 AM (18 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (3 diffs)
-
Source/WebKit/UIProcess/WebPageProxy.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r271636 r271640 1 2021-01-20 Youenn Fablet <youenn@apple.com> 2 3 On page close, make sure to notify of capture state immediately 4 https://bugs.webkit.org/show_bug.cgi?id=220588 5 6 Reviewed by Geoffrey Garen. 7 8 If page is getting closed or reset (for instance in case of process swap), we immediately notify the client of the capture state, 9 instead of waiting for 3 seconds if capture just started. 10 11 Covered by API test. 12 13 * UIProcess/WebPageProxy.cpp: 14 (WebKit::WebPageProxy::isPlayingMediaDidChange): 15 (WebKit::WebPageProxy::updatePlayingMediaDidChange): 16 (WebKit::WebPageProxy::updateReportedMediaCaptureState): 17 * UIProcess/WebPageProxy.h: 18 1 19 2021-01-19 Sihui Liu <sihui_liu@appe.com> 2 20 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r271469 r271640 9034 9034 9035 9035 if (!m_isClosed) 9036 updatePlayingMediaDidChange(newState); 9037 } 9038 9039 void WebPageProxy::updatePlayingMediaDidChange(MediaProducer::MediaStateFlags newState) 9040 { 9041 if (newState == m_mediaState) 9042 return; 9036 updatePlayingMediaDidChange(newState, CanDelayNotification::Yes); 9037 } 9038 9039 void WebPageProxy::updatePlayingMediaDidChange(MediaProducer::MediaStateFlags newState, CanDelayNotification canDelayNotification) 9040 { 9041 #if ENABLE(MEDIA_STREAM) 9042 auto updateMediaCaptureStateImmediatelyIfNeeded = [&] { 9043 if (canDelayNotification == CanDelayNotification::No && m_updateReportedMediaCaptureStateTimer.isActive()) { 9044 m_updateReportedMediaCaptureStateTimer.stop(); 9045 updateReportedMediaCaptureState(); 9046 } 9047 }; 9048 #endif 9049 9050 if (newState == m_mediaState) { 9051 #if ENABLE(MEDIA_STREAM) 9052 updateMediaCaptureStateImmediatelyIfNeeded(); 9053 #endif 9054 return; 9055 } 9043 9056 9044 9057 #if PLATFORM(MACCATALYST) … … 9075 9088 m_userMediaPermissionRequestManager->captureStateChanged(oldMediaCaptureState, newMediaCaptureState); 9076 9089 } 9090 updateMediaCaptureStateImmediatelyIfNeeded(); 9077 9091 #endif 9078 9092 … … 9103 9117 if (!haveReportedCapture && willReportCapture) 9104 9118 m_updateReportedMediaCaptureStateTimer.startOneShot(m_mediaCaptureReportingDelay); 9119 9120 RELEASE_LOG_IF_ALLOWED(WebRTC, "updateReportedMediaCaptureState: from %d to %d", m_reportedMediaCaptureState, activeCaptureState); 9105 9121 9106 9122 m_reportedMediaCaptureState = activeCaptureState; -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r271543 r271640 1441 1441 void updateReportedMediaCaptureState(); 1442 1442 1443 void updatePlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags); 1443 enum class CanDelayNotification { No, Yes }; 1444 void updatePlayingMediaDidChange(WebCore::MediaProducer::MediaStateFlags, CanDelayNotification = CanDelayNotification::No); 1444 1445 bool isCapturingAudio() const { return m_mediaState & WebCore::MediaProducer::AudioCaptureMask; } 1445 1446 bool isCapturingVideo() const { return m_mediaState & WebCore::MediaProducer::VideoCaptureMask; } -
trunk/Tools/ChangeLog
r271636 r271640 1 2021-01-20 Youenn Fablet <youenn@apple.com> 2 3 On page close, make sure to notify of capture state immediately 4 https://bugs.webkit.org/show_bug.cgi?id=220588 5 6 Reviewed by Geoffrey Garen. 7 8 * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm: 9 (TestWebKitAPI::TEST): 10 1 11 2021-01-19 Sihui Liu <sihui_liu@appe.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm
r267563 r271640 240 240 // One additional second should allow us to go back to no capture being reported. 241 241 EXPECT_TRUE(waitUntilCaptureState(webView, _WKMediaCaptureStateNone)); 242 242 } 243 244 TEST(WebKit2, CaptureIndicatorDelayWhenClosed) 245 { 246 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 247 auto processPoolConfig = adoptNS([[_WKProcessPoolConfiguration alloc] init]); 248 auto preferences = [configuration preferences]; 249 preferences._mediaCaptureRequiresSecureConnection = NO; 250 configuration.get()._mediaCaptureEnabled = YES; 251 preferences._mockCaptureDevicesEnabled = YES; 252 253 auto messageHandler = adoptNS([[GUMMessageHandler alloc] init]); 254 [[configuration.get() userContentController] addScriptMessageHandler:messageHandler.get() name:@"gum"]; 255 256 auto webView = [[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get() processPoolConfiguration:processPoolConfig.get()]; 257 webView._mediaCaptureReportingDelayForTesting = 2; 258 259 auto delegate = adoptNS([[GetUserMediaCaptureUIDelegate alloc] init]); 260 webView.UIDelegate = delegate.get(); 261 262 wasPrompted = false; 263 264 [webView loadTestPageNamed:@"getUserMedia"]; 265 EXPECT_TRUE(waitUntilCaptureState(webView, _WKMediaCaptureStateActiveCamera)); 266 267 TestWebKitAPI::Util::run(&wasPrompted); 268 wasPrompted = false; 269 270 [webView _close]; 271 272 EXPECT_EQ([webView _mediaCaptureState], _WKMediaCaptureStateNone); 243 273 } 244 274
Note: See TracChangeset
for help on using the changeset viewer.