Title: [292725] trunk
Revision
292725
Author
jer.no...@apple.com
Date
2022-04-11 14:42:46 -0700 (Mon, 11 Apr 2022)

Log Message

REGRESSION(r292051-r292022): [ iOS ] media/video-object-fit.html is a constant image failure
https://bugs.webkit.org/show_bug.cgi?id=238634
<rdar://problem/91125776>

Reviewed by Eric Carlson.

Source/WebCore:

Depending on whether setVideoFullscreenGravity() or updateVideoLayerGravity() is called first,
the wrong video gravity will be set. Rather than have two places where video gravity is set,
just have setVideoFullscreenGravity() set an ivar, and then call updateVideoLayerGravity(),
which will set the correct gravity based on whether fullscreen is active or not.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity):
(WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):

Source/WebKit:

Use an `std::<optional> bool` rather than `bool` to cache values sent to WebContent, so that
when a new value is pushed in, it's sent to WebContent the first time regardless of the default
value.

* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:

LayoutTests:

* platform/ios-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292724 => 292725)


--- trunk/LayoutTests/ChangeLog	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/LayoutTests/ChangeLog	2022-04-11 21:42:46 UTC (rev 292725)
@@ -1,3 +1,13 @@
+2022-04-11  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION(r292051-r292022): [ iOS ] media/video-object-fit.html is a constant image failure
+        https://bugs.webkit.org/show_bug.cgi?id=238634
+        <rdar://problem/91125776>
+
+        Reviewed by Eric Carlson.
+
+        * platform/ios-wk2/TestExpectations:
+
 2022-04-11  Matteo Flores  <matteo_flo...@apple.com>
 
         webgl/2.0.0/conformance2/glsl3/bool-type-cast-bug-uint-ivec-uvec.html crashes

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (292724 => 292725)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2022-04-11 21:42:46 UTC (rev 292725)
@@ -2246,6 +2246,4 @@
 
 webkit.org/b/237849 imported/w3c/web-platform-tests/css/filter-effects/filters-drop-shadow-003.html [ ImageOnlyFailure ]
 
-webkit.org/b/238634 media/video-object-fit.html [ ImageOnlyFailure ]
-
 fast/text/install-font-style-recalc.html [ Pass ]

Modified: trunk/Source/WebCore/ChangeLog (292724 => 292725)


--- trunk/Source/WebCore/ChangeLog	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/Source/WebCore/ChangeLog	2022-04-11 21:42:46 UTC (rev 292725)
@@ -1,3 +1,22 @@
+2022-04-11  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION(r292051-r292022): [ iOS ] media/video-object-fit.html is a constant image failure
+        https://bugs.webkit.org/show_bug.cgi?id=238634
+        <rdar://problem/91125776>
+
+        Reviewed by Eric Carlson.
+
+        Depending on whether setVideoFullscreenGravity() or updateVideoLayerGravity() is called first,
+        the wrong video gravity will be set. Rather than have two places where video gravity is set,
+        just have setVideoFullscreenGravity() set an ivar, and then call updateVideoLayerGravity(),
+        which will set the correct gravity based on whether fullscreen is active or not.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
+
 2022-04-11  Youenn Fablet  <you...@apple.com>
 
         Expose more ServiceWorker interfaces to workers

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (292724 => 292725)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2022-04-11 21:42:46 UTC (rev 292725)
@@ -233,8 +233,11 @@
     bool hasContextRenderer() const final;
     bool hasLayerRenderer() const final;
 
-    void updateVideoLayerGravity() final;
 
+    enum class ShouldAnimate : bool { No, Yes };
+    void updateVideoLayerGravity() final { updateVideoLayerGravity(ShouldAnimate::No); }
+    void updateVideoLayerGravity(ShouldAnimate);
+
     bool didPassCORSAccessCheck() const final;
     std::optional<bool> wouldTaintOrigin(const SecurityOrigin&) const final;
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (292724 => 292725)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2022-04-11 21:42:46 UTC (rev 292725)
@@ -1317,6 +1317,7 @@
     if (videoFullscreenLayer)
         updateLastImage(UpdateType::UpdateSynchronously);
     m_videoLayerManager->setVideoFullscreenLayer(videoFullscreenLayer, WTFMove(completionHandler), m_lastImage ? m_lastImage->platformImage() : nullptr);
+    updateVideoLayerGravity(ShouldAnimate::Yes);
     updateDisableExternalPlayback();
 }
 
@@ -1329,25 +1330,7 @@
 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenGravity(MediaPlayer::VideoGravity gravity)
 {
     m_videoFullscreenGravity = gravity;
-
-    if (!m_videoLayer)
-        return;
-
-    NSString *videoGravity = AVLayerVideoGravityResizeAspect;
-    if (gravity == MediaPlayer::VideoGravity::Resize)
-        videoGravity = AVLayerVideoGravityResize;
-    else if (gravity == MediaPlayer::VideoGravity::ResizeAspect)
-        videoGravity = AVLayerVideoGravityResizeAspect;
-    else if (gravity == MediaPlayer::VideoGravity::ResizeAspectFill)
-        videoGravity = AVLayerVideoGravityResizeAspectFill;
-    else
-        ASSERT_NOT_REACHED();
-    
-    if ([m_videoLayer videoGravity] == videoGravity)
-        return;
-
-    [m_videoLayer setVideoGravity:videoGravity];
-    syncTextTrackBounds();
+    updateVideoLayerGravity(ShouldAnimate::Yes);
 }
 
 void MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode(MediaPlayer::VideoFullscreenMode mode)
@@ -2219,23 +2202,40 @@
     return timeValue;
 }
 
-void MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity()
+void MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity(ShouldAnimate shouldAnimate)
 {
     if (!m_videoLayer)
         return;
 
+    NSString* videoGravity = shouldMaintainAspectRatio() ? AVLayerVideoGravityResizeAspect : AVLayerVideoGravityResize;
 #if ENABLE(VIDEO_PRESENTATION_MODE)
-    // Do not attempt to change the video gravity while in full screen mode.
-    // See setVideoFullscreenGravity().
-    if (m_videoLayerManager->videoFullscreenLayer())
-        return;
+    if (m_videoLayerManager->videoFullscreenLayer()) {
+        switch (m_videoFullscreenGravity) {
+        case MediaPlayer::VideoGravity::Resize:
+            videoGravity = AVLayerVideoGravityResize;
+            break;
+        case MediaPlayer::VideoGravity::ResizeAspect:
+            videoGravity = AVLayerVideoGravityResizeAspect;
+            break;
+        case MediaPlayer::VideoGravity::ResizeAspectFill:
+            videoGravity = AVLayerVideoGravityResizeAspectFill;
+            break;
+        }
+    }
 #endif
 
+    if ([m_videoLayer videoGravity] == videoGravity)
+        return;
+
+    bool shouldDisableActions = shouldAnimate == ShouldAnimate::No;
+    ALWAYS_LOG(LOGIDENTIFIER, "Setting gravity to \"", String { videoGravity }, "\", animated: ", !shouldDisableActions);
+
     [CATransaction begin];
-    [CATransaction setDisableActions:YES];    
-    NSString* gravity = shouldMaintainAspectRatio() ? AVLayerVideoGravityResizeAspect : AVLayerVideoGravityResize;
-    [m_videoLayer setVideoGravity:gravity];
+    [CATransaction setDisableActions:shouldDisableActions];
+    [m_videoLayer setVideoGravity:videoGravity];
     [CATransaction commit];
+
+    syncTextTrackBounds();
 }
 
 void MediaPlayerPrivateAVFoundationObjC::metadataLoaded()

Modified: trunk/Source/WebKit/ChangeLog (292724 => 292725)


--- trunk/Source/WebKit/ChangeLog	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/Source/WebKit/ChangeLog	2022-04-11 21:42:46 UTC (rev 292725)
@@ -1,3 +1,17 @@
+2022-04-11  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION(r292051-r292022): [ iOS ] media/video-object-fit.html is a constant image failure
+        https://bugs.webkit.org/show_bug.cgi?id=238634
+        <rdar://problem/91125776>
+
+        Reviewed by Eric Carlson.
+
+        Use an `std::<optional> bool` rather than `bool` to cache values sent to WebContent, so that
+        when a new value is pushed in, it's sent to WebContent the first time regardless of the default
+        value.
+
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+
 2022-04-11  Wenson Hsieh  <wenson_hs...@apple.com>
 
         REGRESSION (r289785): [iOS] Unable to double-click to select a word in a received email

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h (292724 => 292725)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2022-04-11 21:33:31 UTC (rev 292724)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2022-04-11 21:42:46 UTC (rev 292725)
@@ -92,7 +92,6 @@
 
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
-    void invalidate() { m_invalid = true; }
     WebCore::MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier() const { return m_remoteEngineIdentifier; }
     WebCore::MediaPlayerIdentifier itentifier() const { return m_id; }
     IPC::Connection& connection() const { return m_manager.gpuProcessConnection().connection(); }
@@ -462,12 +461,11 @@
     bool m_muted { false };
     bool m_seeking { false };
     bool m_isCurrentPlaybackTargetWireless { false };
-    bool m_invalid { false };
     bool m_waitingForKey { false };
     bool m_timeIsProgressing { false };
     bool m_renderingCanBeAccelerated { false };
-    bool m_shouldMaintainAspectRatio { false };
-    bool m_pageIsVisible { false };
+    std::optional<bool> m_shouldMaintainAspectRatio;
+    std::optional<bool> m_pageIsVisible;
     RefPtr<RemoteVideoFrameProxy> m_videoFrameForCurrentTime;
 #if PLATFORM(COCOA)
     RetainPtr<CVPixelBufferRef> m_pixelBufferGatheredWithVideoFrameMetadata;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to