Title: [274264] trunk
Revision
274264
Author
peng.l...@apple.com
Date
2021-03-10 18:40:35 -0800 (Wed, 10 Mar 2021)

Log Message

[GPU Process] Assertion under RenderLayerCompositor::computeCompositingRequirements()
https://bugs.webkit.org/show_bug.cgi?id=220375

Reviewed by Eric Carlson.

Source/WebCore:

`MediaPlayer` calls `HTMLMediaElement::mediaEngineWasUpdated()` when a media element
loads a new URL and `MediaPlayer::supportsAcceleratedRendering()` may change from
false to true at the same time. However, `HTMLMediaElement::mediaEngineWasUpdated()`
does not notify the renderer about the change in the same run loop. Instead, it
schedules a task to do that. This leads to a race condition that
`RenderLayerBacking::contentChanged(VideoChanged)` gets called after the compositing
update where `RenderLayerCompositor::canAccelerateVideoRendering()` returns true.
This happens because renderer checks `MediaPlayer::supportsAcceleratedRendering()`
in `RenderLayerCompositor::canAccelerateVideoRendering()`, which changes its value
when `MediaPlayer` calls `HTMLMediaElement::mediaEngineWasUpdated()`.

To fix this race condition, `HTMLMediaElement` needs to notify `RenderVideo` and
changes the `supportsAcceleratedRendering` property seen from renderer's perspective
in the same run loop. With this patch, `HTMLMediaElement` keeps a cached value of
`MediaPlayer::supportsAcceleratedRendering()`, and only updates its value when
`HTMLMediaElement` notifies the renderer. In addition, `RenderVideo` checks
`HTMLMediaElement::supportsAcceleratedRendering()` instead of
`MediaPlayer::supportsAcceleratedRendering()`, so that the renderer will
see the new value of `supportsAcceleratedRendering` and receive the content
change notification in the same run loop.

No new tests. Fix assertion failures in tests.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaEngineWasUpdated):
(WebCore::HTMLMediaElement::clearMediaPlayer):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::supportsAcceleratedRendering const):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::paintReplaced):
(WebCore::RenderVideo::supportsAcceleratedRendering const):

Source/WebKit:

When "GPU Process: Media" is enabled, `MediaPlayer` will call `mediaPlayerEngineUpdated()`
three times when a media element tries to load a URL. The three calls happen at the
following time points:
1) `MediaPlayer` creates a `MediaPlayerPrivateRemote`.
2) `MediaPlayerPrivateRemote` receives the response of a "createMediaPlayer" message
from the GPU process and gets the initial configurations of the "remote" media player.
3) The `RemoteMediaPlayerProxy` creates a `MediaPlayerPrivate` in the GPU process and
notify the `MediaPlayerPrivateRemote` in the WebContent process.

The second call of `mediaPlayerEngineUpdated()` is unnecessary because the player's
configuration at that time is similar to `NullMediaPlayerPrivate`. This patch removes it.

For the third call of `mediaPlayerEngineUpdated()`, we have to make sure that
the `MediaPlayerPrivateRemote` has received the configuration update from the GPU
process before the call. Therefore, this patch removes the message
`MediaPlayerPrivateRemote::EngineUpdated`, and let `MediaPlayerPrivateRemote`
decide when to call `mediaPlayerEngineUpdated()`.

* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
* GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
* GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in:
The `playerConfiguration` is meaningless in this step so we can remove it.

* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineUpdated): Deleted.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::RemoteMediaPlayerProxy::prepareForPlayback):

* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
(WebKit::MediaPlayerPrivateRemote::load):
(WebKit::MediaPlayerPrivateRemote::setConfiguration): Deleted.
(WebKit::MediaPlayerPrivateRemote::engineUpdated): Deleted.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:

* WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
(WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):

LayoutTests:

* platform/wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274263 => 274264)


--- trunk/LayoutTests/ChangeLog	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/LayoutTests/ChangeLog	2021-03-11 02:40:35 UTC (rev 274264)
@@ -1,3 +1,12 @@
+2021-03-10  Peng Liu  <peng.l...@apple.com>
+
+        [GPU Process] Assertion under RenderLayerCompositor::computeCompositingRequirements()
+        https://bugs.webkit.org/show_bug.cgi?id=220375
+
+        Reviewed by Eric Carlson.
+
+        * platform/wk2/TestExpectations:
+
 2021-03-10  Chris Gambrell  <cgambr...@apple.com>
 
         [LayoutTests] Convert http/tests/security convert PHP to Python

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (274263 => 274264)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2021-03-11 02:40:35 UTC (rev 274264)
@@ -255,11 +255,6 @@
 
 webkit.org/b/221783 [ Debug ] loader/change-src-during-iframe-load-crash.html [ Skip ]
 
-# webkit.org/b/220375
-[ Debug ] imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/event_loadedmetadata.html [ Crash Pass ]
-[ Debug ] imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/event_progress.html [ Crash Pass ]
-[ Debug ] imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/readyState_during_loadeddata.html [ Crash Pass ]
-
 webkit.org/b/222569 fast/mediastream/media-stream-track-interrupted.html [ Crash Pass ]
 
 ### END OF (1) Classified failures with bug reports

Modified: trunk/Source/WebCore/ChangeLog (274263 => 274264)


--- trunk/Source/WebCore/ChangeLog	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebCore/ChangeLog	2021-03-11 02:40:35 UTC (rev 274264)
@@ -1,3 +1,42 @@
+2021-03-10  Peng Liu  <peng.l...@apple.com>
+
+        [GPU Process] Assertion under RenderLayerCompositor::computeCompositingRequirements()
+        https://bugs.webkit.org/show_bug.cgi?id=220375
+
+        Reviewed by Eric Carlson.
+
+        `MediaPlayer` calls `HTMLMediaElement::mediaEngineWasUpdated()` when a media element
+        loads a new URL and `MediaPlayer::supportsAcceleratedRendering()` may change from
+        false to true at the same time. However, `HTMLMediaElement::mediaEngineWasUpdated()`
+        does not notify the renderer about the change in the same run loop. Instead, it
+        schedules a task to do that. This leads to a race condition that
+        `RenderLayerBacking::contentChanged(VideoChanged)` gets called after the compositing
+        update where `RenderLayerCompositor::canAccelerateVideoRendering()` returns true.
+        This happens because renderer checks `MediaPlayer::supportsAcceleratedRendering()`
+        in `RenderLayerCompositor::canAccelerateVideoRendering()`, which changes its value
+        when `MediaPlayer` calls `HTMLMediaElement::mediaEngineWasUpdated()`.
+
+        To fix this race condition, `HTMLMediaElement` needs to notify `RenderVideo` and
+        changes the `supportsAcceleratedRendering` property seen from renderer's perspective
+        in the same run loop. With this patch, `HTMLMediaElement` keeps a cached value of
+        `MediaPlayer::supportsAcceleratedRendering()`, and only updates its value when
+        `HTMLMediaElement` notifies the renderer. In addition, `RenderVideo` checks
+        `HTMLMediaElement::supportsAcceleratedRendering()` instead of
+        `MediaPlayer::supportsAcceleratedRendering()`, so that the renderer will
+        see the new value of `supportsAcceleratedRendering` and receive the content
+        change notification in the same run loop.
+
+        No new tests. Fix assertion failures in tests.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaEngineWasUpdated):
+        (WebCore::HTMLMediaElement::clearMediaPlayer):
+        * html/HTMLMediaElement.h:
+        (WebCore::HTMLMediaElement::supportsAcceleratedRendering const):
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::paintReplaced):
+        (WebCore::RenderVideo::supportsAcceleratedRendering const):
+
 2021-03-10  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, another Windows build fix after r274252.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (274263 => 274264)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-03-11 02:40:35 UTC (rev 274264)
@@ -5005,6 +5005,7 @@
     ALWAYS_LOG(LOGIDENTIFIER);
 
     beginProcessingMediaPlayerCallback();
+    m_cachedSupportsAcceleratedRendering = m_player && m_player->supportsAcceleratedRendering();
     updateRenderer();
     endProcessingMediaPlayerCallback();
 
@@ -5515,6 +5516,7 @@
     if (m_player) {
         m_player->invalidate();
         m_player = nullptr;
+        m_cachedSupportsAcceleratedRendering = false;
     }
     schedulePlaybackControlsManagerUpdate();
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (274263 => 274264)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2021-03-11 02:40:35 UTC (rev 274264)
@@ -146,6 +146,7 @@
     using HTMLElement::weakPtrFactory;
 
     RefPtr<MediaPlayer> player() const { return m_player; }
+    bool supportsAcceleratedRendering() const { return m_cachedSupportsAcceleratedRendering; }
 
     virtual bool isVideo() const { return false; }
     bool hasVideo() const override { return false; }
@@ -1017,6 +1018,7 @@
 #endif
 
     RefPtr<MediaPlayer> m_player;
+    bool m_cachedSupportsAcceleratedRendering { false };
 
     MediaPlayer::Preload m_preload { Preload::Auto };
 

Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (274263 => 274264)


--- trunk/Source/WebCore/rendering/RenderVideo.cpp	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp	2021-03-11 02:40:35 UTC (rev 274264)
@@ -229,7 +229,7 @@
 
     if (displayingPoster)
         paintIntoRect(paintInfo, rect);
-    else if (!videoElement().isFullscreen() || !mediaPlayer->supportsAcceleratedRendering()) {
+    else if (!videoElement().isFullscreen() || !videoElement().supportsAcceleratedRendering()) {
         if (paintInfo.paintBehavior.contains(PaintBehavior::FlattenCompositingLayers))
             context.paintFrameForMedia(*mediaPlayer, rect);
         else
@@ -294,9 +294,7 @@
 
 bool RenderVideo::supportsAcceleratedRendering() const
 {
-    if (auto player = videoElement().player())
-        return player->supportsAcceleratedRendering();
-    return false;
+    return videoElement().supportsAcceleratedRendering();
 }
 
 void RenderVideo::acceleratedRenderingStateChanged()

Modified: trunk/Source/WebKit/ChangeLog (274263 => 274264)


--- trunk/Source/WebKit/ChangeLog	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/ChangeLog	2021-03-11 02:40:35 UTC (rev 274264)
@@ -1,3 +1,51 @@
+2021-03-10  Peng Liu  <peng.l...@apple.com>
+
+        [GPU Process] Assertion under RenderLayerCompositor::computeCompositingRequirements()
+        https://bugs.webkit.org/show_bug.cgi?id=220375
+
+        Reviewed by Eric Carlson.
+
+        When "GPU Process: Media" is enabled, `MediaPlayer` will call `mediaPlayerEngineUpdated()`
+        three times when a media element tries to load a URL. The three calls happen at the
+        following time points:
+        1) `MediaPlayer` creates a `MediaPlayerPrivateRemote`.
+        2) `MediaPlayerPrivateRemote` receives the response of a "createMediaPlayer" message
+        from the GPU process and gets the initial configurations of the "remote" media player.
+        3) The `RemoteMediaPlayerProxy` creates a `MediaPlayerPrivate` in the GPU process and
+        notify the `MediaPlayerPrivateRemote` in the WebContent process.
+
+        The second call of `mediaPlayerEngineUpdated()` is unnecessary because the player's
+        configuration at that time is similar to `NullMediaPlayerPrivate`. This patch removes it.
+
+        For the third call of `mediaPlayerEngineUpdated()`, we have to make sure that
+        the `MediaPlayerPrivateRemote` has received the configuration update from the GPU
+        process before the call. Therefore, this patch removes the message
+        `MediaPlayerPrivateRemote::EngineUpdated`, and let `MediaPlayerPrivateRemote`
+        decide when to call `mediaPlayerEngineUpdated()`.
+
+        * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
+        (WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
+        * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
+        * GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in:
+        The `playerConfiguration` is meaningless in this step so we can remove it.
+
+        * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
+        (WebKit::RemoteMediaPlayerProxy::mediaPlayerEngineUpdated): Deleted.
+        * GPUProcess/media/RemoteMediaPlayerProxy.h:
+        * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
+        (WebKit::RemoteMediaPlayerProxy::prepareForPlayback):
+
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+        (WebKit::MediaPlayerPrivateRemote::MediaPlayerPrivateRemote):
+        (WebKit::MediaPlayerPrivateRemote::load):
+        (WebKit::MediaPlayerPrivateRemote::setConfiguration): Deleted.
+        (WebKit::MediaPlayerPrivateRemote::engineUpdated): Deleted.
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in:
+
+        * WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
+        (WebKit::RemoteMediaPlayerManager::createRemoteMediaPlayer):
+
 2021-03-10  Chris Dumez  <cdu...@apple.com>
 
         Use RetainPtr<> / OSObjectPtr<> more in WebKit

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp (274263 => 274264)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp	2021-03-11 02:40:35 UTC (rev 274264)
@@ -57,7 +57,7 @@
 {
 }
 
-void RemoteMediaPlayerManagerProxy::createMediaPlayer(MediaPlayerIdentifier identifier, MediaPlayerEnums::MediaEngineIdentifier engineIdentifier, RemoteMediaPlayerProxyConfiguration&& proxyConfiguration, CompletionHandler<void(RemoteMediaPlayerConfiguration&)>&& completionHandler)
+void RemoteMediaPlayerManagerProxy::createMediaPlayer(MediaPlayerIdentifier identifier, MediaPlayerEnums::MediaEngineIdentifier engineIdentifier, RemoteMediaPlayerProxyConfiguration&& proxyConfiguration)
 {
     ASSERT(RunLoop::isMain());
     ASSERT(m_gpuConnectionToWebProcess);
@@ -65,13 +65,8 @@
     auto locker = holdLock(m_proxiesLock);
     ASSERT(!m_proxies.contains(identifier));
 
-    RemoteMediaPlayerConfiguration playerConfiguration;
-
     auto proxy = makeUnique<RemoteMediaPlayerProxy>(*this, identifier, m_gpuConnectionToWebProcess->connection(), engineIdentifier, WTFMove(proxyConfiguration));
-    proxy->getConfiguration(playerConfiguration);
     m_proxies.add(identifier, WTFMove(proxy));
-
-    completionHandler(playerConfiguration);
 }
 
 void RemoteMediaPlayerManagerProxy::deleteMediaPlayer(MediaPlayerIdentifier identifier)

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h (274263 => 274264)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h	2021-03-11 02:40:35 UTC (rev 274264)
@@ -71,7 +71,7 @@
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
     bool didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, UniqueRef<IPC::Encoder>&) final;
 
-    void createMediaPlayer(WebCore::MediaPlayerIdentifier, WebCore::MediaPlayerEnums::MediaEngineIdentifier, RemoteMediaPlayerProxyConfiguration&&, CompletionHandler<void(RemoteMediaPlayerConfiguration&)>&&);
+    void createMediaPlayer(WebCore::MediaPlayerIdentifier, WebCore::MediaPlayerEnums::MediaEngineIdentifier, RemoteMediaPlayerProxyConfiguration&&);
     void deleteMediaPlayer(WebCore::MediaPlayerIdentifier);
 
     // Media player factory

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in (274263 => 274264)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.messages.in	2021-03-11 02:40:35 UTC (rev 274264)
@@ -24,7 +24,7 @@
 #if ENABLE(GPU_PROCESS)
 
 messages -> RemoteMediaPlayerManagerProxy NotRefCounted {
-    CreateMediaPlayer(WebCore::MediaPlayerIdentifier identifier, enum:uint8_t WebCore::MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier, struct WebKit::RemoteMediaPlayerProxyConfiguration proxyConfiguration) -> (struct WebKit::RemoteMediaPlayerConfiguration playerConfiguration) Async
+    CreateMediaPlayer(WebCore::MediaPlayerIdentifier identifier, enum:uint8_t WebCore::MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier, struct WebKit::RemoteMediaPlayerProxyConfiguration proxyConfiguration)
     DeleteMediaPlayer(WebCore::MediaPlayerIdentifier identifier)
 
     GetSupportedTypes(enum:uint8_t WebCore::MediaPlayerEnums::MediaEngineIdentifier remoteEngineIdentifier) -> (Vector<String> types) Synchronous

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (274263 => 274264)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2021-03-11 02:40:35 UTC (rev 274264)
@@ -630,11 +630,6 @@
     m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::SizeChanged(m_player->naturalSize()), m_id);
 }
 
-void RemoteMediaPlayerProxy::mediaPlayerEngineUpdated()
-{
-    m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::EngineUpdated(), m_id);
-}
-
 void RemoteMediaPlayerProxy::mediaPlayerActiveSourceBuffersChanged()
 {
     m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::ActiveSourceBuffersChanged(), m_id);

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (274263 => 274264)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2021-03-11 02:40:35 UTC (rev 274264)
@@ -213,7 +213,6 @@
     void mediaPlayerPlaybackStateChanged() final;
     void mediaPlayerResourceNotSupported() final;
     void mediaPlayerEngineFailedToLoad() const final;
-    void mediaPlayerEngineUpdated() final;
     void mediaPlayerActiveSourceBuffersChanged() final;
     void mediaPlayerBufferedTimeRangesChanged() final;
     void mediaPlayerSeekableTimeRangesChanged() final;

Modified: trunk/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm (274263 => 274264)


--- trunk/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm	2021-03-11 02:40:35 UTC (rev 274264)
@@ -54,7 +54,8 @@
     m_player->setPrivateBrowsingMode(privateMode);
     m_player->setPreload(preload);
     m_player->setPreservesPitch(preservesPitch);
-    m_player->prepareForRendering();
+    if (prepareForRendering)
+        m_player->prepareForRendering();
     m_videoContentScale = videoContentScale;
     if (!m_inlineLayerHostingContext)
         m_inlineLayerHostingContext = LayerHostingContext::createForExternalHostingProcess();

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (274263 => 274264)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2021-03-11 02:40:35 UTC (rev 274264)
@@ -111,6 +111,7 @@
     , m_manager(manager)
     , m_remoteEngineIdentifier(engineIdentifier)
     , m_id(playerIdentifier)
+    , m_documentSecurityOrigin(player->documentSecurityOrigin())
 {
     INFO_LOG(LOGIDENTIFIER);
 }
@@ -130,13 +131,6 @@
 #endif
 }
 
-void MediaPlayerPrivateRemote::setConfiguration(RemoteMediaPlayerConfiguration&& configuration, WebCore::SecurityOriginData&& documentSecurityOrigin)
-{
-    m_configuration = WTFMove(configuration);
-    m_documentSecurityOrigin = WTFMove(documentSecurityOrigin);
-    m_player->mediaEngineUpdated();
-}
-
 void MediaPlayerPrivateRemote::prepareForPlayback(bool privateMode, MediaPlayer::Preload preload, bool preservesPitch, bool prepare)
 {
     auto scale = m_player->playerContentsScale();
@@ -181,9 +175,12 @@
         sandboxExtensionHandle = WTFMove(handle);
     }
 
-    connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::Load(url, sandboxExtensionHandle, contentType, keySystem), [weakThis = makeWeakPtr(*this)](auto&& configuration) {
-        if (weakThis)
-            weakThis->m_configuration = WTFMove(configuration);
+    connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::Load(url, sandboxExtensionHandle, contentType, keySystem), [weakThis = makeWeakPtr(*this), this](auto&& configuration) {
+        if (!weakThis)
+            return;
+
+        m_configuration = WTFMove(configuration);
+        m_player->mediaEngineUpdated();
     }, m_id);
 }
 
@@ -661,9 +658,12 @@
 {
     if (m_remoteEngineIdentifier == MediaPlayerEnums::MediaEngineIdentifier::AVFoundationMSE) {
         auto identifier = RemoteMediaSourceIdentifier::generate();
-        connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::LoadMediaSource(url, contentType, RuntimeEnabledFeatures::sharedFeatures().webMParserEnabled(), identifier), [weakThis = makeWeakPtr(*this)](auto&& configuration) {
-            if (weakThis)
-                weakThis->m_configuration = WTFMove(configuration);
+        connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::LoadMediaSource(url, contentType, RuntimeEnabledFeatures::sharedFeatures().webMParserEnabled(), identifier), [weakThis = makeWeakPtr(*this), this](auto&& configuration) {
+            if (!weakThis)
+                return;
+
+            m_configuration = WTFMove(configuration);
+            m_player->mediaEngineUpdated();
         }, m_id);
         m_mediaSourcePrivate = MediaSourcePrivateRemote::create(m_manager.gpuProcessConnection(), identifier, m_manager.typeCache(m_remoteEngineIdentifier), *this, client);
 
@@ -1221,11 +1221,6 @@
     m_player->resourceNotSupported();
 }
 
-void MediaPlayerPrivateRemote::engineUpdated()
-{
-    m_player->mediaEngineUpdated();
-}
-
 void MediaPlayerPrivateRemote::activeSourceBuffersChanged()
 {
     m_player->activeSourceBuffersChanged();

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


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2021-03-11 02:40:35 UTC (rev 274264)
@@ -81,8 +81,6 @@
     MediaPlayerPrivateRemote(WebCore::MediaPlayer*, WebCore::MediaPlayerEnums::MediaEngineIdentifier, WebCore::MediaPlayerIdentifier, RemoteMediaPlayerManager&);
     ~MediaPlayerPrivateRemote();
 
-    void setConfiguration(RemoteMediaPlayerConfiguration&&, WebCore::SecurityOriginData&&);
-
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
     void invalidate() { m_invalid = true; }
@@ -143,8 +141,6 @@
     void sendH2Ping(const URL&, CompletionHandler<void(Expected<WTF::Seconds, WebCore::ResourceError>&&)>&&);
     void resourceNotSupported();
 
-    void engineUpdated();
-
     void activeSourceBuffersChanged();
 
 #if ENABLE(ENCRYPTED_MEDIA)

Modified: trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in (274263 => 274264)


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in	2021-03-11 02:40:35 UTC (rev 274264)
@@ -71,8 +71,6 @@
     SendH2Ping(URL url) -> (Expected<Seconds, WebCore::ResourceError> result) Async
     ResourceNotSupported()
 
-    EngineUpdated()
-
     ActiveSourceBuffersChanged()
 
 #if ENABLE(ENCRYPTED_MEDIA)

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp (274263 => 274264)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2021-03-11 02:39:16 UTC (rev 274263)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2021-03-11 02:40:35 UTC (rev 274264)
@@ -165,17 +165,8 @@
     proxyConfiguration.documentSecurityOrigin = documentSecurityOrigin;
 
     auto identifier = MediaPlayerIdentifier::generate();
-    RemoteMediaPlayerConfiguration playerConfiguration;
-    auto completionHandler = [this, weakThis = makeWeakPtr(this), identifier, documentSecurityOrigin = WTFMove(documentSecurityOrigin)](auto&& playerConfiguration) mutable {
-        if (!weakThis)
-            return;
+    gpuProcessConnection().connection().send(Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer(identifier, remoteEngineIdentifier, proxyConfiguration), 0);
 
-        if (const auto& player = m_players.get(identifier))
-            player->setConfiguration(WTFMove(playerConfiguration), WTFMove(documentSecurityOrigin));
-    };
-
-    gpuProcessConnection().connection().sendWithAsyncReply(Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer(identifier, remoteEngineIdentifier, proxyConfiguration), completionHandler, 0);
-
     auto remotePlayer = MediaPlayerPrivateRemote::create(player, remoteEngineIdentifier, identifier, *this);
     m_players.add(identifier, makeWeakPtr(*remotePlayer));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to