Title: [293074] branches/safari-613-branch
Revision
293074
Author
[email protected]
Date
2022-04-19 22:38:37 -0700 (Tue, 19 Apr 2022)

Log Message

Cherry-pick r292049. rdar://problem/89104216

    [macOS] Muted video is sometimes paused when entering fullscreen
    https://bugs.webkit.org/show_bug.cgi?id=238462
    rdar://89104216

    Reviewed by Jer Noble.

    Source/WebCore:

    Test: media/fullscreen-when-muted.html

    * html/HTMLMediaElement.cpp:
    (WebCore::HTMLMediaElement::didMoveToNewDocument): Add logging.
    (WebCore::HTMLMediaElement::elementIsHidden const): Consider both element fullscreen
    and video fullscreen.
    (WebCore::HTMLMediaElement::visibilityStateChanged): Use elementIsHidden.
    (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): Add
    logging for the one case that didn't have it.
    (WebCore::HTMLMediaElement::updateMediaPlayer): New, wrap MediaPlayer functions
    that are called frequently by RenderVideo so we can only call them when necessary.
    * html/HTMLMediaElement.h:
    (WebCore::HTMLMediaElement::elementIsHidden const): Deleted.

    * html/MediaElementSession.cpp:
    (WebCore::MediaElementSession::visibilityChanged): Just use elementIsHidden, it
    already accounts for fullscreen.

    * platform/graphics/MediaPlayer.cpp:
    (WebCore::MediaPlayer::setVisibleInViewport): Do nothing when visibility is not changing.

    * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
    (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setPageIsVisible): Add logging.

    * rendering/RenderVideo.cpp:
    (WebCore::RenderVideo::updatePlayer): Call HTMLMediaElement::updateMediaPlayer instead
    of calling MediaPlayer directly.

    Source/WebKit:

    * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
    (WebKit::MediaPlayerPrivateRemote::setPageIsVisible): Track visibility and do
    nothing when it doesn't change.
    (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): Ditto for aspect
    ratio.
    * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:

    LayoutTests:

    * media/fullscreen-when-muted-expected.txt: Added.
    * media/fullscreen-when-muted.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (293073 => 293074)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-04-20 05:38:37 UTC (rev 293074)
@@ -1,5 +1,72 @@
 2022-04-19  Alan Coon  <[email protected]>
 
+        Cherry-pick r292049. rdar://problem/89104216
+
+    [macOS] Muted video is sometimes paused when entering fullscreen
+    https://bugs.webkit.org/show_bug.cgi?id=238462
+    rdar://89104216
+    
+    Reviewed by Jer Noble.
+    
+    Source/WebCore:
+    
+    Test: media/fullscreen-when-muted.html
+    
+    * html/HTMLMediaElement.cpp:
+    (WebCore::HTMLMediaElement::didMoveToNewDocument): Add logging.
+    (WebCore::HTMLMediaElement::elementIsHidden const): Consider both element fullscreen
+    and video fullscreen.
+    (WebCore::HTMLMediaElement::visibilityStateChanged): Use elementIsHidden.
+    (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): Add
+    logging for the one case that didn't have it.
+    (WebCore::HTMLMediaElement::updateMediaPlayer): New, wrap MediaPlayer functions
+    that are called frequently by RenderVideo so we can only call them when necessary.
+    * html/HTMLMediaElement.h:
+    (WebCore::HTMLMediaElement::elementIsHidden const): Deleted.
+    
+    * html/MediaElementSession.cpp:
+    (WebCore::MediaElementSession::visibilityChanged): Just use elementIsHidden, it
+    already accounts for fullscreen.
+    
+    * platform/graphics/MediaPlayer.cpp:
+    (WebCore::MediaPlayer::setVisibleInViewport): Do nothing when visibility is not changing.
+    
+    * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+    (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setPageIsVisible): Add logging.
+    
+    * rendering/RenderVideo.cpp:
+    (WebCore::RenderVideo::updatePlayer): Call HTMLMediaElement::updateMediaPlayer instead
+    of calling MediaPlayer directly.
+    
+    Source/WebKit:
+    
+    * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+    (WebKit::MediaPlayerPrivateRemote::setPageIsVisible): Track visibility and do
+    nothing when it doesn't change.
+    (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): Ditto for aspect
+    ratio.
+    * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+    
+    LayoutTests:
+    
+    * media/fullscreen-when-muted-expected.txt: Added.
+    * media/fullscreen-when-muted.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-29  Eric Carlson  <[email protected]>
+
+            [macOS] Muted video is sometimes paused when entering fullscreen
+            https://bugs.webkit.org/show_bug.cgi?id=238462
+            rdar://89104216
+
+            Reviewed by Jer Noble.
+
+            * media/fullscreen-when-muted-expected.txt: Added.
+            * media/fullscreen-when-muted.html: Added.
+
+2022-04-19  Alan Coon  <[email protected]>
+
         Cherry-pick r291689. rdar://problem/88461772
 
     REGRESSION (iOS 15.1 / r280824) QuickLook - model not loading when passing extra parameters

Added: branches/safari-613-branch/LayoutTests/media/fullscreen-when-muted-expected.txt (0 => 293074)


--- branches/safari-613-branch/LayoutTests/media/fullscreen-when-muted-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/media/fullscreen-when-muted-expected.txt	2022-04-20 05:38:37 UTC (rev 293074)
@@ -0,0 +1,13 @@
+Muted video should not pause when entering fullscreen.
+
+EVENT(canplaythrough)
+EVENT(playing)
+EXPECTED (video.muted == 'true') OK
+EXPECTED (video.paused == 'false') OK
+EVENT(webkitfullscreenchange)
+EXPECTED (document.webkitFullscreenElement == '[object HTMLHtmlElement]') OK
+EXPECTED (video.muted == 'true') OK
+EXPECTED (video.paused == 'false') OK
+EVENT(webkitfullscreenchange)
+END OF TEST
+

Added: branches/safari-613-branch/LayoutTests/media/fullscreen-when-muted.html (0 => 293074)


--- branches/safari-613-branch/LayoutTests/media/fullscreen-when-muted.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/media/fullscreen-when-muted.html	2022-04-20 05:38:37 UTC (rev 293074)
@@ -0,0 +1,45 @@
+<html>
+<head>
+    <title>Test that muted video is not paused when entering fullscreen</title>
+    <script src=""
+    <script src=""
+    <script>
+
+    window.addEventListener('load', async event => {
+        findMediaElement();
+
+        video.src = "" 'content/test');
+        await waitFor(video, 'canplaythrough');
+        failTestIn(12000);
+
+        runWithKeyDown(() => video.play());
+        await waitFor(video, 'playing');
+
+        testExpected('video.muted', true);
+        testExpected('video.paused', false);
+
+        runWithKeyDown(() => document.documentElement.webkitRequestFullscreen() );
+
+        await waitFor(document.documentElement, 'webkitfullscreenchange');
+        await sleepFor(250);
+
+        testExpected('document.webkitFullscreenElement', document.documentElement);
+        testExpected('video.muted', true);
+        testExpected('video.paused', false);
+
+        runWithKeyDown(() => document.webkitExitFullscreen() );
+        await waitFor(document.documentElement, 'webkitfullscreenchange');
+
+        endTest();
+    });
+
+    </script>
+</head>
+<body >
+    Muted video should not pause when entering fullscreen.<br>
+    <div id="parent">
+        <video controls muted></video>
+    </div>
+</body>
+</html>
+

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-20 05:38:37 UTC (rev 293074)
@@ -1,5 +1,97 @@
 2022-04-19  Alan Coon  <[email protected]>
 
+        Cherry-pick r292049. rdar://problem/89104216
+
+    [macOS] Muted video is sometimes paused when entering fullscreen
+    https://bugs.webkit.org/show_bug.cgi?id=238462
+    rdar://89104216
+    
+    Reviewed by Jer Noble.
+    
+    Source/WebCore:
+    
+    Test: media/fullscreen-when-muted.html
+    
+    * html/HTMLMediaElement.cpp:
+    (WebCore::HTMLMediaElement::didMoveToNewDocument): Add logging.
+    (WebCore::HTMLMediaElement::elementIsHidden const): Consider both element fullscreen
+    and video fullscreen.
+    (WebCore::HTMLMediaElement::visibilityStateChanged): Use elementIsHidden.
+    (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): Add
+    logging for the one case that didn't have it.
+    (WebCore::HTMLMediaElement::updateMediaPlayer): New, wrap MediaPlayer functions
+    that are called frequently by RenderVideo so we can only call them when necessary.
+    * html/HTMLMediaElement.h:
+    (WebCore::HTMLMediaElement::elementIsHidden const): Deleted.
+    
+    * html/MediaElementSession.cpp:
+    (WebCore::MediaElementSession::visibilityChanged): Just use elementIsHidden, it
+    already accounts for fullscreen.
+    
+    * platform/graphics/MediaPlayer.cpp:
+    (WebCore::MediaPlayer::setVisibleInViewport): Do nothing when visibility is not changing.
+    
+    * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+    (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setPageIsVisible): Add logging.
+    
+    * rendering/RenderVideo.cpp:
+    (WebCore::RenderVideo::updatePlayer): Call HTMLMediaElement::updateMediaPlayer instead
+    of calling MediaPlayer directly.
+    
+    Source/WebKit:
+    
+    * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+    (WebKit::MediaPlayerPrivateRemote::setPageIsVisible): Track visibility and do
+    nothing when it doesn't change.
+    (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): Ditto for aspect
+    ratio.
+    * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+    
+    LayoutTests:
+    
+    * media/fullscreen-when-muted-expected.txt: Added.
+    * media/fullscreen-when-muted.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-29  Eric Carlson  <[email protected]>
+
+            [macOS] Muted video is sometimes paused when entering fullscreen
+            https://bugs.webkit.org/show_bug.cgi?id=238462
+            rdar://89104216
+
+            Reviewed by Jer Noble.
+
+            Test: media/fullscreen-when-muted.html
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::didMoveToNewDocument): Add logging.
+            (WebCore::HTMLMediaElement::elementIsHidden const): Consider both element fullscreen
+            and video fullscreen.
+            (WebCore::HTMLMediaElement::visibilityStateChanged): Use elementIsHidden.
+            (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): Add
+            logging for the one case that didn't have it.
+            (WebCore::HTMLMediaElement::updateMediaPlayer): New, wrap MediaPlayer functions
+            that are called frequently by RenderVideo so we can only call them when necessary.
+            * html/HTMLMediaElement.h:
+            (WebCore::HTMLMediaElement::elementIsHidden const): Deleted.
+
+            * html/MediaElementSession.cpp:
+            (WebCore::MediaElementSession::visibilityChanged): Just use elementIsHidden, it
+            already accounts for fullscreen.
+
+            * platform/graphics/MediaPlayer.cpp:
+            (WebCore::MediaPlayer::setVisibleInViewport): Do nothing when visibility is not changing.
+
+            * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+            (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setPageIsVisible): Add logging.
+
+            * rendering/RenderVideo.cpp:
+            (WebCore::RenderVideo::updatePlayer): Call HTMLMediaElement::updateMediaPlayer instead
+            of calling MediaPlayer directly.
+
+2022-04-19  Alan Coon  <[email protected]>
+
         Cherry-pick r291589. rdar://problem/90511155
 
     LayoutTests/imported/w3c:

Modified: branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-20 05:38:37 UTC (rev 293074)
@@ -685,6 +685,8 @@
 
 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument, Document& newDocument)
 {
+    ALWAYS_LOG(LOGIDENTIFIER);
+
     ASSERT_WITH_SECURITY_IMPLICATION(&document() == &newDocument);
     if (m_shouldDelayLoadEvent) {
         oldDocument.decrementLoadEventDelayCount();
@@ -6022,9 +6024,23 @@
 #endif
 }
 
+bool HTMLMediaElement::elementIsHidden() const
+{
+#if ENABLE(FULLSCREEN_API)
+    auto& fullscreenManager = document().fullscreenManager();
+    if (isVideo() && fullscreenManager.isFullscreen() && fullscreenManager.currentFullscreenElement())
+        return false;
+#endif
+
+    if (m_videoFullscreenMode != VideoFullscreenModeNone)
+        return false;
+
+    return document().hidden();
+}
+
 void HTMLMediaElement::visibilityStateChanged()
 {
-    bool elementIsHidden = document().hidden() && m_videoFullscreenMode == VideoFullscreenModeNone;
+    bool elementIsHidden = this->elementIsHidden();
     if (elementIsHidden == m_elementIsHidden)
         return;
 
@@ -8000,8 +8016,10 @@
             return true;
         }
 #if ENABLE(VIDEO_PRESENTATION_MODE)
-        if (m_videoFullscreenMode == VideoFullscreenModePictureInPicture)
+        if (m_videoFullscreenMode == VideoFullscreenModePictureInPicture) {
+            INFO_LOG(LOGIDENTIFIER, "returning true, in PiP");
             return true;
+        }
 #endif
 #if ENABLE(MEDIA_STREAM)
         if (hasMediaStreamSrcObject() && mediaState().containsAny(MediaProducerMediaState::IsPlayingAudio) && document().mediaState().containsAny(MediaProducerMediaState::HasActiveAudioCaptureDevice)) {
@@ -8267,6 +8285,7 @@
 {
     if (m_player)
         m_player->setVisibleInViewport(isVisibleInViewport());
+
     queueTaskKeepingObjectAlive(*this, TaskSource::MediaElement, [this] {
         if (isContextStopped())
             return;
@@ -8457,6 +8476,15 @@
     return *m_mediaSession;
 }
 
+void HTMLMediaElement::updateMediaPlayer(IntSize elementSize, bool shouldMaintainAspectRatio)
+{
+    ALWAYS_LOG(LOGIDENTIFIER);
+    m_player->setSize(elementSize);
+    visibilityStateChanged();
+    m_player->setVisibleInViewport(isVisibleInViewport());
+    m_player->setShouldMaintainAspectRatio(shouldMaintainAspectRatio);
+}
+
 void HTMLMediaElement::mediaPlayerQueueTaskOnEventLoop(Function<void()>&& task)
 {
     document().eventLoop().queueTask(TaskSource::MediaElement, WTFMove(task));

Modified: branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.h (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.h	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.h	2022-04-20 05:38:37 UTC (rev 293074)
@@ -295,8 +295,6 @@
     WEBCORE_EXPORT bool webkitClosedCaptionsVisible() const;
     WEBCORE_EXPORT void setWebkitClosedCaptionsVisible(bool);
 
-    bool elementIsHidden() const { return m_elementIsHidden; }
-
 #if ENABLE(MEDIA_STATISTICS)
 // Statistics
     unsigned webkitAudioDecodedByteCount() const;
@@ -605,6 +603,9 @@
 
     WEBCORE_EXPORT bool mediaPlayerRenderingCanBeAccelerated() final;
 
+    void updateMediaPlayer(IntSize, bool);
+    WEBCORE_EXPORT bool elementIsHidden() const;
+
 protected:
     HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser);
     virtual ~HTMLMediaElement();
@@ -641,7 +642,6 @@
     void setChangingVideoFullscreenMode(bool value) { m_changingVideoFullscreenMode = value; }
     bool isChangingVideoFullscreenMode() const { return m_changingVideoFullscreenMode; }
 
-protected:
     void mediaPlayerEngineUpdated() override;
 
 private:

Modified: branches/safari-613-branch/Source/WebCore/html/MediaElementSession.cpp (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/html/MediaElementSession.cpp	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/html/MediaElementSession.cpp	2022-04-20 05:38:37 UTC (rev 293074)
@@ -252,7 +252,7 @@
 
     bool elementIsHidden = m_element.elementIsHidden();
 
-    if (elementIsHidden && !m_element.isFullscreen())
+    if (elementIsHidden)
         m_elementIsHiddenUntilVisibleInViewport = true;
     else if (m_element.isVisibleInViewport())
         m_elementIsHiddenUntilVisibleInViewport = false;

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2022-04-20 05:38:37 UTC (rev 293074)
@@ -1035,6 +1035,9 @@
 
 void MediaPlayer::setVisibleInViewport(bool visible)
 {
+    if (visible == m_visibleInViewport)
+        return;
+
     m_visibleInViewport = visible;
     m_private->setVisibleInViewport(visible);
 }

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm	2022-04-20 05:38:37 UTC (rev 293074)
@@ -642,6 +642,7 @@
     if (m_isPageVisible == isVisible)
         return;
 
+    ALWAYS_LOG(LOGIDENTIFIER, isVisible);
     m_isPageVisible = isVisible;
     flushRenderers();
     reenqueueCurrentVideoSampleIfNeeded();

Modified: branches/safari-613-branch/Source/WebCore/rendering/RenderVideo.cpp (293073 => 293074)


--- branches/safari-613-branch/Source/WebCore/rendering/RenderVideo.cpp	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebCore/rendering/RenderVideo.cpp	2022-04-20 05:38:37 UTC (rev 293074)
@@ -272,18 +272,10 @@
     if (!mediaPlayer)
         return;
 
-    if (!videoElement().inActiveDocument()) {
-        mediaPlayer->setPageIsVisible(false);
-        return;
-    }
+    if (videoElement().inActiveDocument())
+        contentChanged(VideoChanged);
 
-    contentChanged(VideoChanged);
-    
-    IntRect videoBounds = videoBox(); 
-    mediaPlayer->setSize(IntSize(videoBounds.width(), videoBounds.height()));
-    mediaPlayer->setPageIsVisible(!videoElement().elementIsHidden());
-    mediaPlayer->setVisibleInViewport(videoElement().isVisibleInViewport());
-    mediaPlayer->setShouldMaintainAspectRatio(style().objectFit() != ObjectFit::Fill);
+    videoElement().updateMediaPlayer(videoBox().size(), style().objectFit() != ObjectFit::Fill);
 }
 
 LayoutUnit RenderVideo::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (293073 => 293074)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-04-20 05:38:37 UTC (rev 293074)
@@ -1,5 +1,76 @@
 2022-04-19  Alan Coon  <[email protected]>
 
+        Cherry-pick r292049. rdar://problem/89104216
+
+    [macOS] Muted video is sometimes paused when entering fullscreen
+    https://bugs.webkit.org/show_bug.cgi?id=238462
+    rdar://89104216
+    
+    Reviewed by Jer Noble.
+    
+    Source/WebCore:
+    
+    Test: media/fullscreen-when-muted.html
+    
+    * html/HTMLMediaElement.cpp:
+    (WebCore::HTMLMediaElement::didMoveToNewDocument): Add logging.
+    (WebCore::HTMLMediaElement::elementIsHidden const): Consider both element fullscreen
+    and video fullscreen.
+    (WebCore::HTMLMediaElement::visibilityStateChanged): Use elementIsHidden.
+    (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const): Add
+    logging for the one case that didn't have it.
+    (WebCore::HTMLMediaElement::updateMediaPlayer): New, wrap MediaPlayer functions
+    that are called frequently by RenderVideo so we can only call them when necessary.
+    * html/HTMLMediaElement.h:
+    (WebCore::HTMLMediaElement::elementIsHidden const): Deleted.
+    
+    * html/MediaElementSession.cpp:
+    (WebCore::MediaElementSession::visibilityChanged): Just use elementIsHidden, it
+    already accounts for fullscreen.
+    
+    * platform/graphics/MediaPlayer.cpp:
+    (WebCore::MediaPlayer::setVisibleInViewport): Do nothing when visibility is not changing.
+    
+    * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+    (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setPageIsVisible): Add logging.
+    
+    * rendering/RenderVideo.cpp:
+    (WebCore::RenderVideo::updatePlayer): Call HTMLMediaElement::updateMediaPlayer instead
+    of calling MediaPlayer directly.
+    
+    Source/WebKit:
+    
+    * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+    (WebKit::MediaPlayerPrivateRemote::setPageIsVisible): Track visibility and do
+    nothing when it doesn't change.
+    (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): Ditto for aspect
+    ratio.
+    * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+    
+    LayoutTests:
+    
+    * media/fullscreen-when-muted-expected.txt: Added.
+    * media/fullscreen-when-muted.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-29  Eric Carlson  <[email protected]>
+
+            [macOS] Muted video is sometimes paused when entering fullscreen
+            https://bugs.webkit.org/show_bug.cgi?id=238462
+            rdar://89104216
+
+            Reviewed by Jer Noble.
+
+            * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+            (WebKit::MediaPlayerPrivateRemote::setPageIsVisible): Track visibility and do
+            nothing when it doesn't change.
+            (WebKit::MediaPlayerPrivateRemote::setShouldMaintainAspectRatio): Ditto for aspect
+            ratio.
+            * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+
+2022-04-19  Alan Coon  <[email protected]>
+
         Cherry-pick r292044. rdar://problem/86662565
 
     Don't send sync RemoteMediaPlayerProxy messages that we know will fail

Modified: branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (293073 => 293074)


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2022-04-20 05:38:37 UTC (rev 293074)
@@ -564,11 +564,21 @@
 
 void MediaPlayerPrivateRemote::setPageIsVisible(bool visible)
 {
+    if (m_pageIsVisible == visible)
+        return;
+
+    ALWAYS_LOG(LOGIDENTIFIER, visible);
+
+    m_pageIsVisible = visible;
     connection().send(Messages::RemoteMediaPlayerProxy::SetPageIsVisible(visible), m_id);
 }
 
 void MediaPlayerPrivateRemote::setShouldMaintainAspectRatio(bool maintainRatio)
 {
+    if (maintainRatio == m_shouldMaintainAspectRatio)
+        return;
+
+    m_shouldMaintainAspectRatio = maintainRatio;
     connection().send(Messages::RemoteMediaPlayerProxy::SetShouldMaintainAspectRatio(maintainRatio), m_id);
 }
 

Modified: branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h (293073 => 293074)


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2022-04-20 05:38:30 UTC (rev 293073)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2022-04-20 05:38:37 UTC (rev 293074)
@@ -462,6 +462,8 @@
     bool m_waitingForKey { false };
     bool m_timeIsProgressing { false };
     bool m_renderingCanBeAccelerated { false };
+    bool m_shouldMaintainAspectRatio { false };
+    bool m_pageIsVisible { false };
     std::optional<WebCore::MediaSampleVideoFrame> m_videoFrameForCurrentTime;
 #if PLATFORM(COCOA)
     RetainPtr<CVPixelBufferRef> m_pixelBufferGatheredWithVideoFrameMetadata;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to