Title: [284944] branches/safari-612-branch/Source/WebCore
Revision
284944
Author
[email protected]
Date
2021-10-27 14:05:34 -0700 (Wed, 27 Oct 2021)

Log Message

Cherry-pick r283583. rdar://problem/83606128

    REGRESSION (Monterey): paramountplus.com: Cannot enter fullscreen in Safari
    https://bugs.webkit.org/show_bug.cgi?id=231005

    The page performs a lot of canvas readbacks when entering or exiting
    fullscreen mode.
    When the media is encrypted, attempting to do so would have made the
    sync call from the content to GPU process hang for one full second.
    Worse the CATransaction should it fail to paint would retry continuously.
    After 10 attempts (and blocking the process for over 10s) the
    content process would get automatically killed.
    This works around rdar://83867877 where outputMediaDataWillChange isn't
    called following a call to
    [AVPlayerItemVideoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval].
    In case we timed out. we will disable this functionality until there's a
    track change.

    Reviewed by Eric Carlson.

    We do not have the infrastructure to easily test interacting with encrypted
    content. Once bug 231006 is fixed, we could write a test to ensure that canvas
    readbacks do not lock-up.

    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
    (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
    (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283583 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (284943 => 284944)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-10-27 21:05:30 UTC (rev 284943)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-10-27 21:05:34 UTC (rev 284944)
@@ -1,5 +1,67 @@
 2021-10-26  Alan Coon  <[email protected]>
 
+        Cherry-pick r283583. rdar://problem/83606128
+
+    REGRESSION (Monterey): paramountplus.com: Cannot enter fullscreen in Safari
+    https://bugs.webkit.org/show_bug.cgi?id=231005
+    
+    The page performs a lot of canvas readbacks when entering or exiting
+    fullscreen mode.
+    When the media is encrypted, attempting to do so would have made the
+    sync call from the content to GPU process hang for one full second.
+    Worse the CATransaction should it fail to paint would retry continuously.
+    After 10 attempts (and blocking the process for over 10s) the
+    content process would get automatically killed.
+    This works around rdar://83867877 where outputMediaDataWillChange isn't
+    called following a call to
+    [AVPlayerItemVideoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval].
+    In case we timed out. we will disable this functionality until there's a
+    track change.
+    
+    Reviewed by Eric Carlson.
+    
+    We do not have the infrastructure to easily test interacting with encrypted
+    content. Once bug 231006 is fixed, we could write a test to ensure that canvas
+    readbacks do not lock-up.
+    
+    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+    (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
+    (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-10-05  Jean-Yves Avenard  <[email protected]>
+
+            REGRESSION (Monterey): paramountplus.com: Cannot enter fullscreen in Safari
+            https://bugs.webkit.org/show_bug.cgi?id=231005
+
+            The page performs a lot of canvas readbacks when entering or exiting
+            fullscreen mode.
+            When the media is encrypted, attempting to do so would have made the
+            sync call from the content to GPU process hang for one full second.
+            Worse the CATransaction should it fail to paint would retry continuously.
+            After 10 attempts (and blocking the process for over 10s) the
+            content process would get automatically killed.
+            This works around rdar://83867877 where outputMediaDataWillChange isn't
+            called following a call to
+            [AVPlayerItemVideoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval].
+            In case we timed out. we will disable this functionality until there's a
+            track change.
+
+            Reviewed by Eric Carlson.
+
+            We do not have the infrastructure to easily test interacting with encrypted
+            content. Once bug 231006 is fixed, we could write a test to ensure that canvas
+            readbacks do not lock-up.
+
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
+            (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
+
+2021-10-26  Alan Coon  <[email protected]>
+
         Cherry-pick r283362. rdar://problem/84629481
 
     Cocoa GraphicsContextGLOpenGL should not be used by GraphicsContextGLCVANGLE

Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (284943 => 284944)


--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2021-10-27 21:05:30 UTC (rev 284943)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2021-10-27 21:05:34 UTC (rev 284944)
@@ -438,6 +438,7 @@
     bool m_shouldPlayToPlaybackTarget { false };
 #endif
     bool m_runningModalPaint { false };
+    bool m_waitForVideoOutputMediaDataWillChangeTimedOut { false };
 };
 
 }

Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (284943 => 284944)


--- branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-10-27 21:05:30 UTC (rev 284943)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2021-10-27 21:05:34 UTC (rev 284944)
@@ -2340,6 +2340,10 @@
     for (auto& track : m_audioTracks)
         track->resetPropertiesFromTrack();
 
+    // In case the video track content changed, we may be able to perform a readback again.
+    if (count)
+        m_waitForVideoOutputMediaDataWillChangeTimedOut = false;
+
     ALWAYS_LOG(LOGIDENTIFIER, "track count was ", count, ", is ", m_videoTracks.size());
 }
 
@@ -2553,6 +2557,8 @@
 
 void MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange()
 {
+    if (m_waitForVideoOutputMediaDataWillChangeTimedOut)
+        return;
     [m_videoOutput requestNotificationOfMediaDataChangeWithAdvanceInterval:0];
 
     // Wait for 1 second.
@@ -2568,9 +2574,10 @@
     m_runningModalPaint = false;
 
     bool satisfied = timeoutTimer.isActive();
-    if (!satisfied)
+    if (!satisfied) {
         ERROR_LOG(LOGIDENTIFIER, "timed out");
-    else
+        m_waitForVideoOutputMediaDataWillChangeTimedOut = true;
+    } else
         INFO_LOG(LOGIDENTIFIER, "waiting for videoOutput took ", (MonotonicTime::now() - start).seconds());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to