Title: [271273] trunk/Source/WebKit
Revision
271273
Author
[email protected]
Date
2021-01-07 16:30:58 -0800 (Thu, 07 Jan 2021)

Log Message

PlaybackSessionManager::m_clientCounts is not updated correctly when a video enters picture-in-picture from fullscreen
https://bugs.webkit.org/show_bug.cgi?id=220435

Reviewed by Eric Carlson.

* WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
When a fullscreen video enters picture-in-picture, we should not call `addClientForContext()`
because `m_clientCounts` was updated when the video entered fullscreen.
(WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
We need to call `removeClientForContext()` in this function like `didCleanupFullscreen()` does.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (271272 => 271273)


--- trunk/Source/WebKit/ChangeLog	2021-01-08 00:29:18 UTC (rev 271272)
+++ trunk/Source/WebKit/ChangeLog	2021-01-08 00:30:58 UTC (rev 271273)
@@ -1,3 +1,17 @@
+2021-01-07  Peng Liu  <[email protected]>
+
+        PlaybackSessionManager::m_clientCounts is not updated correctly when a video enters picture-in-picture from fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=220435
+
+        Reviewed by Eric Carlson.
+
+        * WebProcess/cocoa/VideoFullscreenManager.mm:
+        (WebKit::VideoFullscreenManager::enterVideoFullscreenForVideoElement):
+        When a fullscreen video enters picture-in-picture, we should not call `addClientForContext()`
+        because `m_clientCounts` was updated when the video entered fullscreen.
+        (WebKit::VideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation):
+        We need to call `removeClientForContext()` in this function like `didCleanupFullscreen()` does.
+
 2021-01-07  Eric Carlson  <[email protected]>
 
         [Mac] Add runtime logging to format reader and WebM parser

Modified: trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm (271272 => 271273)


--- trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2021-01-08 00:29:18 UTC (rev 271272)
+++ trunk/Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm	2021-01-08 00:30:58 UTC (rev 271273)
@@ -250,7 +250,9 @@
     auto [model, interface] = ensureModelAndInterface(contextId);
     HTMLMediaElementEnums::VideoFullscreenMode oldMode = interface->fullscreenMode();
 
-    addClientForContext(contextId);
+    if (oldMode == HTMLMediaElementEnums::VideoFullscreenModeNone)
+        addClientForContext(contextId);
+
     if (!interface->layerHostingContext())
         interface->setLayerHostingContext(LayerHostingContext::createForExternalHostingProcess());
 
@@ -329,6 +331,7 @@
     auto& interface = ensureInterface(contextId);
 
     interface.setTargetIsFullscreen(false);
+    removeClientForContext(contextId);
 
     m_page->send(Messages::VideoFullscreenManagerProxy::ExitFullscreenWithoutAnimationToMode(contextId, targetMode));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to