Title: [292916] branches/safari-613-branch/Source

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292915 => 292916)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-04-15 18:45:47 UTC (rev 292916)
@@ -1,3 +1,27 @@
+2022-04-15  Russell Epstein  <[email protected]>
+
+        Apply patch. rdar://problem/84869202
+
+    2022-03-03  Eric Carlson  <[email protected]>
+
+            Push HTMLMediaElement renderer's contentBox rect to GPU process
+            https://bugs.webkit.org/show_bug.cgi?id=237444
+            rdar://84869202
+
+            Reviewed by Jer Noble.
+
+            No new tests. This is a speculative fix, with new logging, for an issue I haven't
+            been able to reproduce.
+
+            * html/HTMLMediaElement.cpp:
+            (WebCore::HTMLMediaElement::updateRenderer): Push mediaPlayerContentBoxRect to the
+            media player.
+            * platform/graphics/MediaPlayer.cpp:
+            (WebCore::MediaPlayer::playerContentBoxRectChanged): Pass rect to platform player.
+            * platform/graphics/MediaPlayer.h:
+            * platform/graphics/MediaPlayerPrivate.h:
+            (WebCore::MediaPlayerPrivateInterface::playerContentBoxRectChanged):
+
 2022-04-13  Kocsen Chung  <[email protected]>
 
         Cherry-pick r292801. rdar://problem/91346216

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


--- branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebCore/html/HTMLMediaElement.cpp	2022-04-15 18:45:47 UTC (rev 292916)
@@ -894,6 +894,9 @@
 
     if (m_mediaControlsHost)
         m_mediaControlsHost->updateCaptionDisplaySizes();
+
+    if (m_player)
+        m_player->playerContentBoxRectChanged(mediaPlayerContentBoxRect());
 }
 
 void HTMLMediaElement::didAttachRenderers()

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


--- branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.cpp	2022-04-15 18:45:47 UTC (rev 292916)
@@ -1729,6 +1729,11 @@
     m_private->stopVideoFrameMetadataGathering();
 }
 
+void MediaPlayer::playerContentBoxRectChanged(const LayoutRect& rect)
+{
+    m_private->playerContentBoxRectChanged(rect);
+}
+
 #if PLATFORM(COCOA)
 void MediaPlayer::onNewVideoFrameMetadata(VideoFrameMetadata&& metadata, RetainPtr<CVPixelBufferRef>&& buffer)
 {

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.h (292915 => 292916)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.h	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayer.h	2022-04-15 18:45:47 UTC (rev 292916)
@@ -687,6 +687,8 @@
     void startVideoFrameMetadataGathering();
     void stopVideoFrameMetadataGathering();
 
+    void playerContentBoxRectChanged(const LayoutRect&);
+
 private:
     MediaPlayer(MediaPlayerClient&);
     MediaPlayer(MediaPlayerClient&, MediaPlayerEnums::MediaEngineIdentifier);

Modified: branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (292915 => 292916)


--- branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2022-04-15 18:45:47 UTC (rev 292916)
@@ -324,6 +324,7 @@
     virtual std::optional<VideoFrameMetadata> videoFrameMetadata() { return { }; }
     virtual void startVideoFrameMetadataGathering() { }
     virtual void stopVideoFrameMetadataGathering() { }
+    virtual void playerContentBoxRectChanged(const LayoutRect&) { }
 };
 
 }

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-04-15 18:45:47 UTC (rev 292916)
@@ -1,3 +1,42 @@
+2022-04-15  Russell Epstein  <[email protected]>
+
+        Apply patch. rdar://problem/84869202
+
+    2022-03-03  Eric Carlson  <[email protected]>
+
+            Push HTMLMediaElement renderer's contentBox rect to GPU process
+            https://bugs.webkit.org/show_bug.cgi?id=237444
+            rdar://84869202
+
+            Reviewed by Jer Noble.
+
+            * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
+            (WebKit::RemoteMediaPlayerProxy::RemoteMediaPlayerProxy): Configuration now has
+            playerContentBoxRect.
+            (WebKit::RemoteMediaPlayerProxy::mediaPlayerContentBoxRect const):
+            (WebKit::RemoteMediaPlayerProxy::playerContentBoxRectChanged): Update playerContentBoxRect.
+            * GPUProcess/media/RemoteMediaPlayerProxy.h:
+            * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
+
+            * GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h:
+            (WebKit::RemoteMediaPlayerProxyConfiguration::encode const):
+            (WebKit::RemoteMediaPlayerProxyConfiguration::decode):
+
+            * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
+            (WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeIfPossible): Convert from static
+            function so we can log.
+            (WebKit::RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable): Add logging.
+            (WebKit::RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged): Ditto.
+            (WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced): Ditto.
+            (WebKit::setVideoInlineSizeIfPossible): Deleted.
+
+            * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+            (WebKit::MediaPlayerPrivateRemote::playerContentBoxRectChanged):
+            * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+
+            * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
+            (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
+
 2022-04-07  Alan Coon  <[email protected]>
 
         Cherry-pick r291881. rdar://problem/90848454

Modified: branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2022-04-15 18:45:47 UTC (rev 292916)
@@ -87,6 +87,7 @@
 {
     m_typesRequiringHardwareSupport = m_configuration.mediaContentTypesRequiringHardwareSupport;
     m_renderingCanBeAccelerated = m_configuration.renderingCanBeAccelerated;
+    m_playerContentBoxRect = m_configuration.playerContentBoxRect;
     m_player = MediaPlayer::create(*this, m_engineIdentifier);
 }
 
@@ -472,6 +473,11 @@
     return m_manager->gpuConnectionToWebProcess()->mediaCacheDirectory();
 }
 
+LayoutRect RemoteMediaPlayerProxy::mediaPlayerContentBoxRect() const
+{
+    return m_playerContentBoxRect;
+}
+
 const Vector<WebCore::ContentType>& RemoteMediaPlayerProxy::mediaContentTypesRequiringHardwareSupport() const
 {
     return m_typesRequiringHardwareSupport;
@@ -1125,6 +1131,11 @@
         m_player->startVideoFrameMetadataGathering();
 }
 
+void RemoteMediaPlayerProxy::playerContentBoxRectChanged(const WebCore::LayoutRect& contentRect)
+{
+    m_playerContentBoxRect = contentRect;
+}
+
 #if !RELEASE_LOG_DISABLED
 WTFLogChannel& RemoteMediaPlayerProxy::logChannel() const
 {

Modified: branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2022-04-15 18:45:47 UTC (rev 292916)
@@ -268,6 +268,7 @@
     bool doesHaveAttribute(const AtomString&, AtomString* = nullptr) const final;
     bool mediaPlayerShouldUsePersistentCache() const final;
     const String& mediaPlayerMediaCacheDirectory() const final;
+    WebCore::LayoutRect mediaPlayerContentBoxRect() const final;
 
     void textTrackRepresentationBoundsChanged(const WebCore::IntRect&) final;
 
@@ -313,10 +314,13 @@
     void mediaPlayerOnNewVideoFrameMetadata(WebCore::VideoFrameMetadata&&, RetainPtr<CVPixelBufferRef>&&);
 #endif
 
+    void playerContentBoxRectChanged(const WebCore::LayoutRect&);
+
     bool mediaPlayerPausedOrStalled() const;
     void currentTimeChanged(const MediaTime&);
 
 #if PLATFORM(COCOA)
+    void setVideoInlineSizeIfPossible(const WebCore::FloatSize&);
     void nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&, WebCore::DestinationColorSpace)>&&);
     void colorSpace(CompletionHandler<void(WebCore::DestinationColorSpace)>&&);
 #endif
@@ -359,6 +363,7 @@
 
     WebCore::FloatSize m_videoInlineSize;
     float m_videoContentScale { 1.0 };
+    WebCore::LayoutRect m_playerContentBoxRect;
 
     bool m_bufferedChanged { true };
     bool m_renderingCanBeAccelerated { false };

Modified: branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in	2022-04-15 18:45:47 UTC (rev 292916)
@@ -133,6 +133,8 @@
 
     StartVideoFrameMetadataGathering()
     StopVideoFrameMetadataGathering()
+
+    PlayerContentBoxRectChanged(WebCore::LayoutRect contentRect)
 }
 
 #endif

Modified: branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h	2022-04-15 18:45:47 UTC (rev 292916)
@@ -58,6 +58,7 @@
         encoder << sourceApplicationIdentifier;
         encoder << networkInterfaceName;
         encoder << mediaContentTypesRequiringHardwareSupport;
+        encoder << playerContentBoxRect;
         encoder << preferredAudioCharacteristics;
 #if ENABLE(AVF_CAPTIONS)
         encoder << outOfBandTrackData;
@@ -97,6 +98,11 @@
         if (!mediaContentTypesRequiringHardwareSupport)
             return std::nullopt;
 
+        std::optional<WebCore::LayoutRect> playerContentBoxRect;
+        decoder >> playerContentBoxRect;
+        if (!playerContentBoxRect)
+            return std::nullopt;
+
         std::optional<Vector<String>> preferredAudioCharacteristics;
         decoder >> preferredAudioCharacteristics;
         if (!preferredAudioCharacteristics)
@@ -140,6 +146,7 @@
             WTFMove(*sourceApplicationIdentifier),
             WTFMove(*networkInterfaceName),
             WTFMove(*mediaContentTypesRequiringHardwareSupport),
+            WTFMove(*playerContentBoxRect),
             WTFMove(*preferredAudioCharacteristics),
 #if ENABLE(AVF_CAPTIONS)
             WTFMove(*outOfBandTrackData),

Modified: branches/safari-613-branch/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm	2022-04-15 18:45:47 UTC (rev 292916)
@@ -38,15 +38,17 @@
 
 namespace WebKit {
 
-static void setVideoInlineSizeIfPossible(LayerHostingContext& context, const WebCore::FloatSize& size)
+void RemoteMediaPlayerProxy::setVideoInlineSizeIfPossible(const WebCore::FloatSize& size)
 {
-    if (!context.rootLayer() || size.isEmpty())
+    if (!m_inlineLayerHostingContext->rootLayer() || size.isEmpty())
         return;
 
+    ALWAYS_LOG(LOGIDENTIFIER, size.width(), "x", size.height());
+
     // We do not want animations here.
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
-    [context.rootLayer() setFrame:CGRectMake(0, 0, size.width(), size.height())];
+    [m_inlineLayerHostingContext->rootLayer() setFrame:CGRectMake(0, 0, size.width(), size.height())];
     [CATransaction commit];
 }
 
@@ -66,22 +68,24 @@
 
 void RemoteMediaPlayerProxy::mediaPlayerFirstVideoFrameAvailable()
 {
-    // Initially the size of the platformLayer may be 0x0 because we do not provide mediaPlayerContentBoxRect() in this class.
-    setVideoInlineSizeIfPossible(*m_inlineLayerHostingContext, m_videoInlineSize);
+    ALWAYS_LOG(LOGIDENTIFIER);
+    setVideoInlineSizeIfPossible(m_videoInlineSize);
     m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::FirstVideoFrameAvailable(), m_id);
 }
 
 void RemoteMediaPlayerProxy::mediaPlayerRenderingModeChanged()
 {
+    ALWAYS_LOG(LOGIDENTIFIER);
     m_inlineLayerHostingContext->setRootLayer(m_player->platformLayer());
     m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::RenderingModeChanged(), m_id);
 }
 void RemoteMediaPlayerProxy::setVideoInlineSizeFenced(const WebCore::FloatSize& size, const WTF::MachSendRight& machSendRight)
 {
+    ALWAYS_LOG(LOGIDENTIFIER, size.width(), "x", size.height());
     m_inlineLayerHostingContext->setFencePort(machSendRight.sendRight());
 
     m_videoInlineSize = size;
-    setVideoInlineSizeIfPossible(*m_inlineLayerHostingContext, size);
+    setVideoInlineSizeIfPossible(size);
 }
 
 void RemoteMediaPlayerProxy::mediaPlayerOnNewVideoFrameMetadata(VideoFrameMetadata&& metadata, RetainPtr<CVPixelBufferRef>&& buffer)

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


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2022-04-15 18:45:47 UTC (rev 292916)
@@ -1412,6 +1412,11 @@
     connection().send(Messages::RemoteMediaPlayerProxy::StopVideoFrameMetadataGathering(), m_id);
 }
 
+void MediaPlayerPrivateRemote::playerContentBoxRectChanged(const LayoutRect& contentRect)
+{
+    connection().send(Messages::RemoteMediaPlayerProxy::PlayerContentBoxRectChanged(contentRect), m_id);
+}
+
 void MediaPlayerPrivateRemote::requestResource(RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, WebCore::ResourceRequest&& request, WebCore::PlatformMediaResourceLoader::LoadOptions options, CompletionHandler<void()>&& completionHandler)
 {
     ASSERT(!m_mediaResources.contains(remoteMediaResourceIdentifier));

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


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2022-04-15 18:45:47 UTC (rev 292916)
@@ -409,6 +409,8 @@
     void startVideoFrameMetadataGathering() final;
     void stopVideoFrameMetadataGathering() final;
 
+    void playerContentBoxRectChanged(const WebCore::LayoutRect&) final;
+
 #if PLATFORM(COCOA)
     void pushVideoFrameMetadata(WebCore::VideoFrameMetadata&&, RetainPtr<CVPixelBufferRef>&&);
 #endif

Modified: branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp (292915 => 292916)


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2022-04-15 18:08:04 UTC (rev 292915)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2022-04-15 18:45:47 UTC (rev 292916)
@@ -165,6 +165,7 @@
 
     auto documentSecurityOrigin = player->documentSecurityOrigin();
     proxyConfiguration.documentSecurityOrigin = documentSecurityOrigin;
+    proxyConfiguration.playerContentBoxRect = player->playerContentBoxRect();
 
     auto identifier = MediaPlayerIdentifier::generate();
     gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer(identifier, remoteEngineIdentifier, proxyConfiguration), 0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to