Title: [258082] trunk/Source
Revision
258082
Author
[email protected]
Date
2020-03-07 15:19:55 -0800 (Sat, 07 Mar 2020)

Log Message

Implement setWirelessPlaybackTarget, performTaskAtMediaTime, and wouldTaintOrigin in GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=208651
<rdar://problem/60088298>

Reviewed by Youenn Fablet.

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateActiveTextTrackCues): Remove unused lambda parameter.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::performTaskAtMediaTime): Make MediaTime parameter const ref
so it isn't copied.
* platform/graphics/MediaPlayer.h:

* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::performTaskAtMediaTime): Ditto.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime): Ditto.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime): Ditto.

* platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
(WebCore::VideoLayerManagerObjC::setVideoFullscreenLayer): Don't set inline image
contents if image is NULL.

Source/WebKit:

* GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::dispatchSyncMessage): Dispatch player manager messages.

* GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::didReceiveSyncPlayerMessage): Dispatch player messages.
* GPUProcess/media/RemoteMediaPlayerManagerProxy.h:

* GPUProcess/media/RemoteMediaPlayerProxy.cpp:
(WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy): Clear the completion handler
do its destructor doesn't assert.
(WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget): Implement.
(WebKit::RemoteMediaPlayerProxy::performTaskAtMediaTime): Ditto.
(WebKit::RemoteMediaPlayerProxy::wouldTaintOrigin): Ditto.
* GPUProcess/media/RemoteMediaPlayerProxy.h:
* GPUProcess/media/RemoteMediaPlayerProxy.messages.in:

* WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::updateCachedState): Update wireless playback target name.
(WebKit::MediaPlayerPrivateRemote::load): Don't log as unimplemented.
(WebKit::MediaPlayerPrivateRemote::wirelessPlaybackTargetName const): Return cached name.
(WebKit::MediaPlayerPrivateRemote::setWirelessPlaybackTarget): Implement.
(WebKit::MediaPlayerPrivateRemote::wouldTaintOrigin const): Ditto.
(WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime): Ditto.
(WebKit::MediaPlayerPrivateRemote::setClosedCaptionsVisible): Deleted, not needed.
(WebKit::MediaPlayerPrivateRemote::simulateAudioInterruption): Ditto.
* WebProcess/GPU/media/MediaPlayerPrivateRemote.h:

* WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h:
(WebKit::RemoteMediaPlayerConfiguration::decode): Decode supportsFullscreen too.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258081 => 258082)


--- trunk/Source/WebCore/ChangeLog	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/ChangeLog	2020-03-07 23:19:55 UTC (rev 258082)
@@ -1,3 +1,34 @@
+2020-03-07  Eric Carlson  <[email protected]>
+
+        Implement setWirelessPlaybackTarget, performTaskAtMediaTime, and wouldTaintOrigin in GPUProcess
+        https://bugs.webkit.org/show_bug.cgi?id=208651
+        <rdar://problem/60088298>
+
+        Reviewed by Youenn Fablet.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updateActiveTextTrackCues): Remove unused lambda parameter.
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::performTaskAtMediaTime): Make MediaTime parameter const ref
+        so it isn't copied.
+        * platform/graphics/MediaPlayer.h:
+
+        * platform/graphics/MediaPlayerPrivate.h:
+        (WebCore::MediaPlayerPrivateInterface::performTaskAtMediaTime): Ditto.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime): Ditto.
+
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime): Ditto.
+
+        * platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm:
+        (WebCore::VideoLayerManagerObjC::setVideoFullscreenLayer): Don't set inline image
+        contents if image is NULL.
+
 2020-03-07  Brady Eidson  <[email protected]>
 
         Add runtime flag for incremental PDF loading.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (258081 => 258082)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -1732,7 +1732,7 @@
     INFO_LOG(LOGIDENTIFIER, "nextInterestingTime:", nextInterestingTime);
 
     if (nextInterestingTime.isValid() && m_player) {
-        m_player->performTaskAtMediaTime([this, weakThis = makeWeakPtr(this), nextInterestingTime] {
+        m_player->performTaskAtMediaTime([this, weakThis = makeWeakPtr(this)] {
             if (!weakThis)
                 return;
 
@@ -8183,6 +8183,11 @@
     scriptExecutionContext()->eventLoop().queueTask(TaskSource::MediaElement, WTFMove(function));
 }
 
+SecurityOriginData HTMLMediaElement::documentSecurityOrigin() const
+{
+    return document().securityOrigin().data();
 }
 
+}
+
 #endif

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (258081 => 258082)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -620,6 +620,8 @@
 
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
 
+    SecurityOriginData documentSecurityOrigin() const final;
+
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     bool mediaControlsDependOnPageScaleFactor() const { return m_mediaControlsDependOnPageScaleFactor; }
     void setMediaControlsDependOnPageScaleFactor(bool);

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (258081 => 258082)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -1580,7 +1580,7 @@
 
 #endif
 
-bool MediaPlayer::performTaskAtMediaTime(WTF::Function<void()>&& task, MediaTime time)
+bool MediaPlayer::performTaskAtMediaTime(WTF::Function<void()>&& task, const MediaTime& time)
 {
     return m_private->performTaskAtMediaTime(WTFMove(task), time);
 }
@@ -1595,6 +1595,12 @@
     client().mediaPlayerEngineFailedToLoad();
 }
 
+SecurityOriginData MediaPlayer::documentSecurityOrigin() const
+{
+    return client().documentSecurityOrigin();
+}
+
+
 #if !RELEASE_LOG_DISABLED
 const Logger& MediaPlayer::mediaPlayerLogger()
 {

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (258081 => 258082)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -77,6 +77,7 @@
 
 struct Cookie;
 struct GraphicsDeviceAdapter;
+struct SecurityOriginData;
 
 struct MediaEngineSupportParameters {
     ContentType type;
@@ -270,6 +271,8 @@
     virtual void mediaPlayerBufferedTimeRangesChanged() { }
     virtual void mediaPlayerSeekableTimeRangesChanged() { }
 
+    virtual SecurityOriginData documentSecurityOrigin() const { return { }; }
+
 #if !RELEASE_LOG_DISABLED
     virtual const void* mediaPlayerLogIdentifier() { return nullptr; }
     virtual const Logger& mediaPlayerLogger() = 0;
@@ -600,7 +603,7 @@
     AVPlayer *objCAVFoundationAVPlayer() const;
 #endif
 
-    bool performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime);
+    bool performTaskAtMediaTime(Function<void()>&&, const MediaTime&);
 
     bool shouldIgnoreIntrinsicSize();
 
@@ -618,6 +621,7 @@
     bool isLooping() const { return client().mediaPlayerIsLooping(); }
 
     void remoteEngineFailedToLoad();
+    SecurityOriginData documentSecurityOrigin() const;
 
 #if USE(GSTREAMER)
     void requestInstallMissingPlugins(const String& details, const String& description, MediaPlayerRequestInstallMissingPluginsCallback& callback) { client().requestInstallMissingPlugins(details, description, callback); }

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (258081 => 258082)


--- trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -285,7 +285,7 @@
     virtual AVPlayer *objCAVFoundationAVPlayer() const { return nullptr; }
 #endif
 
-    virtual bool performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime) { return false; }
+    virtual bool performTaskAtMediaTime(Function<void()>&&, const MediaTime&) { return false; }
 
     virtual bool shouldIgnoreIntrinsicSize() { return false; }
 };

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -333,7 +333,7 @@
 
     AVPlayer *objCAVFoundationAVPlayer() const final { return m_avPlayer.get(); }
 
-    bool performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime) final;
+    bool performTaskAtMediaTime(Function<void()>&&, const MediaTime&) final;
     void setShouldObserveTimeControlStatus(bool);
 
     RetainPtr<AVURLAsset> m_avAsset;

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


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2020-03-07 23:19:55 UTC (rev 258082)
@@ -3237,7 +3237,7 @@
 #endif
 }
 
-bool MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime(WTF::Function<void()>&& task, MediaTime time)
+bool MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime(WTF::Function<void()>&& task, const MediaTime& time)
 {
     if (!m_avPlayer)
         return false;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (258081 => 258082)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -252,7 +252,7 @@
     bool wirelessVideoPlaybackDisabled() const override { return false; }
 #endif
 
-    bool performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime) final;
+    bool performTaskAtMediaTime(Function<void()>&&, const MediaTime&) final;
 
     void ensureLayer();
     void destroyLayer();

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (258081 => 258082)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2020-03-07 23:19:55 UTC (rev 258082)
@@ -1218,7 +1218,7 @@
 }
 #endif
 
-bool MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime(WTF::Function<void()>&& task, MediaTime time)
+bool MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtMediaTime(WTF::Function<void()>&& task, const MediaTime& time)
 {
     __block WTF::Function<void()> taskIn = WTFMove(task);
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm (258081 => 258082)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoLayerManagerObjC.mm	2020-03-07 23:19:55 UTC (rev 258082)
@@ -98,7 +98,7 @@
     if (m_videoLayer) {
         CAContext *oldContext = [m_videoLayer context];
 
-        if (m_videoInlineLayer)
+        if (m_videoInlineLayer && currentImage)
             [m_videoInlineLayer setContents:(__bridge id)currentImage.get()];
 
         if (m_videoFullscreenLayer) {

Modified: trunk/Source/WebKit/ChangeLog (258081 => 258082)


--- trunk/Source/WebKit/ChangeLog	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/ChangeLog	2020-03-07 23:19:55 UTC (rev 258082)
@@ -1,3 +1,41 @@
+2020-03-07  Eric Carlson  <[email protected]>
+
+        Implement setWirelessPlaybackTarget, performTaskAtMediaTime, and wouldTaintOrigin in GPUProcess
+        https://bugs.webkit.org/show_bug.cgi?id=208651
+        <rdar://problem/60088298>
+
+        Reviewed by Youenn Fablet.
+
+        * GPUProcess/GPUConnectionToWebProcess.cpp:
+        (WebKit::GPUConnectionToWebProcess::dispatchSyncMessage): Dispatch player manager messages.
+
+        * GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
+        (WebKit::RemoteMediaPlayerManagerProxy::didReceiveSyncPlayerMessage): Dispatch player messages.
+        * GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
+
+        * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
+        (WebKit::RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy): Clear the completion handler
+        do its destructor doesn't assert.
+        (WebKit::RemoteMediaPlayerProxy::setWirelessPlaybackTarget): Implement.
+        (WebKit::RemoteMediaPlayerProxy::performTaskAtMediaTime): Ditto.
+        (WebKit::RemoteMediaPlayerProxy::wouldTaintOrigin): Ditto.
+        * GPUProcess/media/RemoteMediaPlayerProxy.h:
+        * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
+
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
+        (WebKit::MediaPlayerPrivateRemote::updateCachedState): Update wireless playback target name.
+        (WebKit::MediaPlayerPrivateRemote::load): Don't log as unimplemented.
+        (WebKit::MediaPlayerPrivateRemote::wirelessPlaybackTargetName const): Return cached name.
+        (WebKit::MediaPlayerPrivateRemote::setWirelessPlaybackTarget): Implement.
+        (WebKit::MediaPlayerPrivateRemote::wouldTaintOrigin const): Ditto.
+        (WebKit::MediaPlayerPrivateRemote::performTaskAtMediaTime): Ditto.
+        (WebKit::MediaPlayerPrivateRemote::setClosedCaptionsVisible): Deleted, not needed.
+        (WebKit::MediaPlayerPrivateRemote::simulateAudioInterruption): Ditto.
+        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
+
+        * WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h:
+        (WebKit::RemoteMediaPlayerConfiguration::decode): Decode supportsFullscreen too.
+
 2020-03-07  Brady Eidson  <[email protected]>
 
         Add runtime flag for incremental PDF loading.

Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -386,6 +386,10 @@
         remoteMediaPlayerManagerProxy().didReceiveSyncMessageFromWebProcess(connection, decoder, replyEncoder);
         return true;
     }
+    if (decoder.messageReceiverName() == Messages::RemoteMediaPlayerProxy::messageReceiverName()) {
+        remoteMediaPlayerManagerProxy().didReceiveSyncPlayerMessage(connection, decoder, replyEncoder);
+        return true;
+    }
 #if ENABLE(MEDIA_STREAM)
     if (decoder.messageReceiverName() == Messages::UserMediaCaptureManagerProxy::messageReceiverName()) {
         userMediaCaptureManagerProxy().didReceiveSyncMessageFromGPUProcess(connection, decoder, replyEncoder);

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -198,6 +198,12 @@
         player->didReceiveMessage(connection, decoder);
 }
 
+void RemoteMediaPlayerManagerProxy::didReceiveSyncPlayerMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& encoder)
+{
+    if (auto* player = m_proxies.get(makeObjectIdentifier<MediaPlayerPrivateRemoteIdentifierType>(decoder.destinationID())))
+        player->didReceiveSyncMessage(connection, decoder, encoder);
+}
+
 #if !RELEASE_LOG_DISABLED
 const Logger& RemoteMediaPlayerManagerProxy::logger() const
 {

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -59,6 +59,7 @@
     void didReceiveMessageFromWebProcess(IPC::Connection& connection, IPC::Decoder& decoder) { didReceiveMessage(connection, decoder); }
     void didReceiveSyncMessageFromWebProcess(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& encoder) { didReceiveSyncMessage(connection, decoder, encoder); }
     void didReceivePlayerMessage(IPC::Connection&, IPC::Decoder&);
+    void didReceiveSyncPlayerMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&);
 
 #if !RELEASE_LOG_DISABLED
     const Logger& logger() const final;

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -52,6 +52,11 @@
 #include "RemoteCDMFactoryProxy.h"
 #endif
 
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+#include <WebCore/MediaPlaybackTargetCocoa.h>
+#include <WebCore/MediaPlaybackTargetMock.h>
+#endif
+
 namespace WebKit {
 
 using namespace WebCore;
@@ -73,6 +78,8 @@
 
 RemoteMediaPlayerProxy::~RemoteMediaPlayerProxy()
 {
+    if (m_performTaskAtMediaTimeCompletionHandler)
+        m_performTaskAtMediaTimeCompletionHandler(WTF::nullopt);
 }
 
 void RemoteMediaPlayerProxy::invalidate()
@@ -140,12 +147,12 @@
     sendCachedState();
 }
 
-void RemoteMediaPlayerProxy::seek(MediaTime&& time)
+void RemoteMediaPlayerProxy::seek(const MediaTime& time)
 {
     m_player->seek(time);
 }
 
-void RemoteMediaPlayerProxy::seekWithTolerance(MediaTime&& time, MediaTime&& negativeTolerance, MediaTime&& positiveTolerance)
+void RemoteMediaPlayerProxy::seekWithTolerance(const MediaTime& time, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance)
 {
     m_player->seekWithTolerance(time, negativeTolerance, positiveTolerance);
 }
@@ -282,6 +289,7 @@
     m_cachedState.wirelessVideoPlaybackDisabled = m_player->wirelessVideoPlaybackDisabled();
     m_cachedState.hasSingleSecurityOrigin = m_player->hasSingleSecurityOrigin();
     m_cachedState.didPassCORSAccessCheck = m_player->didPassCORSAccessCheck();
+    m_cachedState.wouldTaintDocumentSecurityOrigin = m_player->wouldTaintOrigin(m_configuration.documentSecurityOrigin.securityOrigin());
 
     m_webProcessConnection->send(Messages::MediaPlayerPrivateRemote::ReadyStateChanged(m_cachedState), m_id);
 }
@@ -558,7 +566,26 @@
 {
     m_player->setShouldPlayToPlaybackTarget(shouldPlay);
 }
+
+void RemoteMediaPlayerProxy::setWirelessPlaybackTarget(const WebCore::MediaPlaybackTargetContext& targetContext)
+{
+#if !PLATFORM(IOS_FAMILY)
+    switch (targetContext.type()) {
+    case MediaPlaybackTargetContext::AVOutputContextType:
+        m_player->setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetCocoa::create(targetContext.avOutputContext()));
+        break;
+    case MediaPlaybackTargetContext::MockType:
+        m_player->setWirelessPlaybackTarget(WebCore::MediaPlaybackTargetMock::create(targetContext.mockDeviceName(), targetContext.mockState()));
+        break;
+    case MediaPlaybackTargetContext::None:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+#else
+    UNUSED_PARAM(targetContext);
 #endif
+}
+#endif
 
 void RemoteMediaPlayerProxy::mediaPlayerEnterFullscreen()
 {
@@ -770,6 +797,39 @@
     m_player->syncTextTrackBounds();
 }
 
+void RemoteMediaPlayerProxy::performTaskAtMediaTime(const MediaTime& taskTime, WallTime messageTime, CompletionHandler<void(Optional<MediaTime>)>&& completionHandler)
+{
+    if (m_performTaskAtMediaTimeCompletionHandler) {
+        // A media player is only expected to track one pending task-at-time at once (e.g. see
+        // MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime), so cancel the existing
+        // CompletionHandler.
+        auto handler = WTFMove(m_performTaskAtMediaTimeCompletionHandler);
+        handler(WTF::nullopt);
+    }
+
+    auto transmissionTime = MediaTime::createWithDouble((WallTime::now() - messageTime).value(), 1);
+    auto adjustedTaskTime = taskTime - transmissionTime;
+    auto currentTime = m_player->currentTime();
+    if (adjustedTaskTime <= currentTime) {
+        completionHandler(currentTime);
+        return;
+    }
+
+    m_performTaskAtMediaTimeCompletionHandler = WTFMove(completionHandler);
+    m_player->performTaskAtMediaTime([this, weakThis = makeWeakPtr(this)]() mutable {
+        if (!weakThis || !m_performTaskAtMediaTimeCompletionHandler)
+            return;
+
+        auto completionHandler = WTFMove(m_performTaskAtMediaTimeCompletionHandler);
+        completionHandler(m_player->currentTime());
+    }, adjustedTaskTime);
+}
+
+void RemoteMediaPlayerProxy::wouldTaintOrigin(struct WebCore::SecurityOriginData originData, CompletionHandler<void(Optional<bool>)>&& completionHandler)
+{
+    completionHandler(m_player->wouldTaintOrigin(originData.securityOrigin()));
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -109,8 +109,8 @@
     void play();
     void pause();
 
-    void seek(MediaTime&&);
-    void seekWithTolerance(MediaTime&&, MediaTime&& negativeTolerance, MediaTime&& positiveTolerance);
+    void seek(const MediaTime&);
+    void seekWithTolerance(const MediaTime&, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance);
 
     void setVolume(double);
     void setMuted(bool);
@@ -140,6 +140,7 @@
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
     void setWirelessVideoPlaybackDisabled(bool);
     void setShouldPlayToPlaybackTarget(bool);
+    void setWirelessPlaybackTarget(const WebCore::MediaPlaybackTargetContext&);
 #endif
 
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
@@ -168,6 +169,9 @@
     void tracksChanged();
     void syncTextTrackBounds();
 
+    void performTaskAtMediaTime(const MediaTime&, WallTime, CompletionHandler<void(Optional<MediaTime>)>&&);
+    void wouldTaintOrigin(struct WebCore::SecurityOriginData, CompletionHandler<void(Optional<bool>)>&&);
+
     Ref<WebCore::PlatformMediaResource> requestResource(WebCore::ResourceRequest&&, WebCore::PlatformMediaResourceLoader::LoadOptions);
     void removeResource(RemoteMediaResourceIdentifier);
 
@@ -279,11 +283,14 @@
     RunLoop::Timer<RemoteMediaPlayerProxy> m_updateCachedStateMessageTimer;
     RemoteMediaPlayerState m_cachedState;
     RemoteMediaPlayerProxyConfiguration m_configuration;
-    bool m_bufferedChanged { true };
-    bool m_renderingCanBeAccelerated { true };
+    CompletionHandler<void(Optional<MediaTime>)> m_performTaskAtMediaTimeCompletionHandler;
+
     WebCore::LayoutRect m_videoContentBoxRect;
     float m_videoContentScale { 1.0 };
 
+    bool m_bufferedChanged { true };
+    bool m_renderingCanBeAccelerated { true };
+
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) && ENABLE(ENCRYPTED_MEDIA)
     bool m_shouldContinueAfterKeyNeeded { false };
 #endif

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in	2020-03-07 23:19:55 UTC (rev 258082)
@@ -106,6 +106,11 @@
     TracksChanged()
     SyncTextTrackBounds()
 
+    SetWirelessPlaybackTarget(WebCore::MediaPlaybackTargetContext target)
+
+    PerformTaskAtMediaTime(MediaTime mediaTime, WallTime messageTime) -> (Optional<MediaTime> mediaTime) Async
+    WouldTaintOrigin(struct WebCore::SecurityOriginData origin) -> (Optional<bool> wouldTaint) Synchronous
+
 #if PLATFORM(IOS_FAMILY)
     ErrorLog() -> (String errorLog) Synchronous
     AccessLog() -> (String accessLog) Synchronous

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h (258081 => 258082)


--- trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxyConfiguration.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -28,6 +28,7 @@
 #if ENABLE(GPU_PROCESS)
 
 #include <WebCore/ContentType.h>
+#include <WebCore/SecurityOriginData.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebKit {
@@ -39,6 +40,7 @@
     String networkInterfaceName;
     Vector<WebCore::ContentType> mediaContentTypesRequiringHardwareSupport;
     Vector<String> preferredAudioCharacteristics;
+    WebCore::SecurityOriginData documentSecurityOrigin;
     uint64_t logIdentifier { 0 };
     bool shouldUsePersistentCache { false };
     bool isVideo { 0 };
@@ -52,6 +54,7 @@
         encoder << networkInterfaceName;
         encoder << mediaContentTypesRequiringHardwareSupport;
         encoder << preferredAudioCharacteristics;
+        encoder << documentSecurityOrigin;
         encoder << logIdentifier;
         encoder << shouldUsePersistentCache;
         encoder << isVideo;
@@ -90,6 +93,11 @@
         if (!preferredAudioCharacteristics)
             return WTF::nullopt;
 
+        Optional<WebCore::SecurityOriginData> documentSecurityOrigin;
+        decoder >> documentSecurityOrigin;
+        if (!documentSecurityOrigin)
+            return WTF::nullopt;
+
         Optional<uint64_t> logIdentifier;
         decoder >> logIdentifier;
         if (!logIdentifier)
@@ -112,6 +120,7 @@
             WTFMove(*networkInterfaceName),
             WTFMove(*mediaContentTypesRequiringHardwareSupport),
             WTFMove(*preferredAudioCharacteristics),
+            WTFMove(*documentSecurityOrigin),
             *logIdentifier,
             *shouldUsePersistentCache,
             *isVideo,

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


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -87,9 +87,10 @@
     INFO_LOG(LOGIDENTIFIER);
 }
 
-void MediaPlayerPrivateRemote::setConfiguration(RemoteMediaPlayerConfiguration&& configuration)
+void MediaPlayerPrivateRemote::setConfiguration(RemoteMediaPlayerConfiguration&& configuration, WebCore::SecurityOriginData&& documentSecurityOrigin)
 {
     m_configuration = WTFMove(configuration);
+    m_documentSecurityOrigin = WTFMove(documentSecurityOrigin);
     m_player->mediaEngineUpdated();
 }
 
@@ -366,6 +367,7 @@
     m_cachedState.naturalSize = state.naturalSize;
     m_cachedState.movieLoadType = state.movieLoadType;
     m_cachedState.wirelessPlaybackTargetType = state.wirelessPlaybackTargetType;
+    m_cachedState.wirelessPlaybackTargetName = state.wirelessPlaybackTargetName;
 
     m_cachedState.startDate = state.startDate;
     m_cachedState.startTime = state.startTime;
@@ -595,7 +597,6 @@
 #if ENABLE(MEDIA_SOURCE)
 void MediaPlayerPrivateRemote::load(const String&, MediaSourcePrivateClient*)
 {
-    notImplemented();
     callOnMainThread([weakThis = makeWeakPtr(*this), this] {
         if (!weakThis)
             return;
@@ -719,11 +720,6 @@
     return m_cachedState.hasClosedCaptions;
 }
 
-void MediaPlayerPrivateRemote::setClosedCaptionsVisible(bool)
-{
-    notImplemented();
-}
-
 double MediaPlayerPrivateRemote::maxFastForwardRate() const
 {
     return m_cachedState.maxFastForwardRate;
@@ -797,8 +793,7 @@
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 String MediaPlayerPrivateRemote::wirelessPlaybackTargetName() const
 {
-    notImplemented();
-    return emptyString();
+    return m_cachedState.wirelessPlaybackTargetName;
 }
 
 MediaPlayer::WirelessPlaybackTargetType MediaPlayerPrivateRemote::wirelessPlaybackTargetType() const
@@ -827,9 +822,9 @@
     return m_isCurrentPlaybackTargetWireless;
 }
 
-void MediaPlayerPrivateRemote::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&)
+void MediaPlayerPrivateRemote::setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&& target)
 {
-    notImplemented();
+    connection().send(Messages::RemoteMediaPlayerProxy::SetWirelessPlaybackTarget(target->targetContext()), m_id);
 }
 
 void MediaPlayerPrivateRemote::setShouldPlayToPlaybackTarget(bool shouldPlay)
@@ -848,10 +843,21 @@
     return m_cachedState.didPassCORSAccessCheck;
 }
 
-Optional<bool> MediaPlayerPrivateRemote::wouldTaintOrigin(const SecurityOrigin&) const
+Optional<bool> MediaPlayerPrivateRemote::wouldTaintOrigin(const SecurityOrigin& origin) const
 {
-    notImplemented();
-    return WTF::nullopt;
+    if (origin.data() == m_documentSecurityOrigin)
+        return m_cachedState.wouldTaintDocumentSecurityOrigin;
+
+    if (auto result = m_wouldTaintOriginCache.get(origin.data()))
+        return result;
+
+    Optional<bool> wouldTaint;
+    if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::WouldTaintOrigin(origin.data()), Messages::RemoteMediaPlayerProxy::WouldTaintOrigin::Reply(wouldTaint), m_id))
+        return WTF::nullopt;
+
+    m_wouldTaintOriginCache.add(origin.data(), wouldTaint);
+
+    return wouldTaint;
 }
 
 MediaTime MediaPlayerPrivateRemote::mediaTimeForTimeValue(const MediaTime& timeValue) const
@@ -982,13 +988,6 @@
 }
 #endif
 
-#if USE(GSTREAMER)
-void MediaPlayerPrivateRemote::simulateAudioInterruption()
-{
-    notImplemented();
-}
-#endif
-
 void MediaPlayerPrivateRemote::beginSimulatedHDCPError()
 {
     connection().send(Messages::RemoteMediaPlayerProxy::BeginSimulatedHDCPError(), m_id);
@@ -1039,10 +1038,19 @@
     connection().send(Messages::RemoteMediaPlayerProxy::ApplicationDidBecomeActive(), m_id);
 }
 
-bool MediaPlayerPrivateRemote::performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime)
+bool MediaPlayerPrivateRemote::performTaskAtMediaTime(WTF::Function<void()>&& completionHandler, const MediaTime& mediaTime)
 {
-    notImplemented();
-    return false;
+    auto asyncReplyHandler = [weakThis = makeWeakPtr(*this), this, completionHandler = WTFMove(completionHandler)](Optional<MediaTime> currentTime) mutable {
+        if (!weakThis || !currentTime)
+            return;
+
+        m_cachedState.currentTime = *currentTime;
+        completionHandler();
+    };
+
+    connection().sendWithAsyncReply(Messages::RemoteMediaPlayerProxy::PerformTaskAtMediaTime(mediaTime, WallTime::now()), WTFMove(asyncReplyHandler), m_id);
+
+    return true;
 }
 
 void MediaPlayerPrivateRemote::requestResource(RemoteMediaResourceIdentifier remoteMediaResourceIdentifier, WebCore::ResourceRequest&& request, WebCore::PlatformMediaResourceLoader::LoadOptions options, CompletionHandler<void()>&& completionHandler)

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


--- trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -35,6 +35,7 @@
 #include "RemoteMediaResourceProxy.h"
 #include "TrackPrivateRemoteIdentifier.h"
 #include <WebCore/MediaPlayerPrivate.h>
+#include <WebCore/SecurityOriginData.h>
 #include <wtf/LoggerHelper.h>
 #include <wtf/MediaTime.h>
 #include <wtf/WeakPtr.h>
@@ -75,7 +76,7 @@
     MediaPlayerPrivateRemote(WebCore::MediaPlayer*, WebCore::MediaPlayerEnums::MediaEngineIdentifier, MediaPlayerPrivateRemoteIdentifier, RemoteMediaPlayerManager&);
     ~MediaPlayerPrivateRemote();
 
-    void setConfiguration(RemoteMediaPlayerConfiguration&&);
+    void setConfiguration(RemoteMediaPlayerConfiguration&&, WebCore::SecurityOriginData&&);
 
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
 
@@ -233,7 +234,6 @@
 #endif
 
     bool hasClosedCaptions() const final;
-    void setClosedCaptionsVisible(bool) final;
 
     double maxFastForwardRate() const final;
     double minFastReverseRate() const final;
@@ -327,10 +327,6 @@
     void tracksChanged() final;
 #endif
 
-#if USE(GSTREAMER)
-    void simulateAudioInterruption() final;
-#endif
-
     void beginSimulatedHDCPError() final;
     void endSimulatedHDCPError() final;
 
@@ -355,7 +351,7 @@
     AVPlayer *objCAVFoundationAVPlayer() const final { return nullptr; }
 #endif
 
-    bool performTaskAtMediaTime(WTF::Function<void()>&&, MediaTime) final;
+    bool performTaskAtMediaTime(Function<void()>&&, const MediaTime&) final;
 
     WebCore::MediaPlayer* m_player { nullptr };
     RefPtr<WebCore::PlatformMediaResourceLoader> m_mediaResourceLoader;
@@ -375,6 +371,9 @@
     HashMap<TrackPrivateRemoteIdentifier, Ref<VideoTrackPrivateRemote>> m_videoTracks;
     HashMap<TrackPrivateRemoteIdentifier, Ref<TextTrackPrivateRemote>> m_textTracks;
 
+    WebCore::SecurityOriginData m_documentSecurityOrigin;
+    mutable HashMap<WebCore::SecurityOriginData, Optional<bool>> m_wouldTaintOriginCache;
+
     double m_volume { 1 };
     double m_rate { 1 };
     long m_platformErrorCode { 0 };

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h (258081 => 258082)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerConfiguration.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -103,6 +103,7 @@
             WTFMove(*engineDescription),
             *maximumDurationToCacheMediaTime,
             *supportsScanning,
+            *supportsFullscreen,
             *supportsPictureInPicture,
             *supportsAcceleratedRendering,
             *canPlayToWirelessPlaybackTarget,

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


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp	2020-03-07 23:19:55 UTC (rev 258082)
@@ -156,16 +156,21 @@
     proxyConfiguration.shouldUsePersistentCache = player->shouldUsePersistentCache();
     proxyConfiguration.isVideo = player->isVideoPlayer();
 
+    auto documentSecurityOrigin = player->documentSecurityOrigin();
+    proxyConfiguration.documentSecurityOrigin = documentSecurityOrigin;
+
     auto identifier = MediaPlayerPrivateRemoteIdentifier::generate();
     RemoteMediaPlayerConfiguration playerConfiguration;
-    gpuProcessConnection().connection().sendWithAsyncReply(Messages::RemoteMediaPlayerManagerProxy::CreateMediaPlayer(identifier, remoteEngineIdentifier, proxyConfiguration), [this, weakThis = makeWeakPtr(this), identifier](auto&& playerConfiguration) {
+    auto completionHandler = [this, weakThis = makeWeakPtr(this), identifier, documentSecurityOrigin = WTFMove(documentSecurityOrigin)](auto&& playerConfiguration) mutable {
         if (!weakThis)
             return;
 
         if (const auto& player = m_players.get(identifier))
-            player->setConfiguration(WTFMove(playerConfiguration));
-    }, 0);
+            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));
 

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerState.h (258081 => 258082)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerState.h	2020-03-07 22:53:38 UTC (rev 258081)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerState.h	2020-03-07 23:19:55 UTC (rev 258082)
@@ -54,6 +54,7 @@
     double seekableTimeRangesLastModifiedTime { 0 };
     double liveUpdateInterval { 0 };
     unsigned long long totalBytes { 0 };
+    Optional<bool> wouldTaintDocumentSecurityOrigin { true };
     bool paused { true };
     bool loadingProgressed { false };
     bool canSaveMediaData { false };
@@ -88,6 +89,7 @@
         encoder << seekableTimeRangesLastModifiedTime;
         encoder << liveUpdateInterval;
         encoder << totalBytes;
+        encoder << wouldTaintDocumentSecurityOrigin;
         encoder << paused;
         encoder << loadingProgressed;
         encoder << canSaveMediaData;
@@ -195,6 +197,11 @@
         if (!totalBytes)
             return WTF::nullopt;
 
+        Optional<Optional<bool>> wouldTaintDocumentSecurityOrigin;
+        decoder >> wouldTaintDocumentSecurityOrigin;
+        if (!wouldTaintDocumentSecurityOrigin)
+            return WTF::nullopt;
+
         Optional<bool> paused;
         decoder >> paused;
         if (!paused)
@@ -270,6 +277,7 @@
             *seekableTimeRangesLastModifiedTime,
             *liveUpdateInterval,
             *totalBytes,
+            WTFMove(*wouldTaintDocumentSecurityOrigin),
             *paused,
             *loadingProgressed,
             *canSaveMediaData,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to