Title: [268970] trunk/Source/WebCore
Revision
268970
Author
[email protected]
Date
2020-10-26 05:42:18 -0700 (Mon, 26 Oct 2020)

Log Message

Remove MediaPlayer::m_visible
https://bugs.webkit.org/show_bug.cgi?id=217810

Reviewed by Eric Carlson.

MediaPlayer::visible() is only used by MediaPlayerPrivateAVFoundation and MediaPlayerPrivateGStreamer but they have their own m_visible state.
We need to keep m_visible and add m_visibleForCanvas to keep the state when changing of engine.
No change of behavior.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setVisible):
(WebCore::MediaPlayer::setVisibleForCanvas):
* platform/graphics/MediaPlayer.h:
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::preferredRenderingMode const):
(WebCore::MediaPlayerPrivateAVFoundation::isReadyForVideoSetup const):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::paint):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268969 => 268970)


--- trunk/Source/WebCore/ChangeLog	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/ChangeLog	2020-10-26 12:42:18 UTC (rev 268970)
@@ -1,3 +1,26 @@
+2020-10-26  Youenn Fablet  <[email protected]>
+
+        Remove MediaPlayer::m_visible
+        https://bugs.webkit.org/show_bug.cgi?id=217810
+
+        Reviewed by Eric Carlson.
+
+        MediaPlayer::visible() is only used by MediaPlayerPrivateAVFoundation and MediaPlayerPrivateGStreamer but they have their own m_visible state.
+        We need to keep m_visible and add m_visibleForCanvas to keep the state when changing of engine.
+        No change of behavior.
+
+        * platform/graphics/MediaPlayer.cpp:
+        (WebCore::MediaPlayer::setVisible):
+        (WebCore::MediaPlayer::setVisibleForCanvas):
+        * platform/graphics/MediaPlayer.h:
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundation::preferredRenderingMode const):
+        (WebCore::MediaPlayerPrivateAVFoundation::isReadyForVideoSetup const):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::paint):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
+
 2020-10-26  Xabier Rodriguez Calvar  <[email protected]>
 
         [EME][Thunder][GStreamer] Assert on 0 length messages from Thunder

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (268969 => 268970)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp	2020-10-26 12:42:18 UTC (rev 268970)
@@ -560,6 +560,8 @@
         m_private = engine->createMediaEnginePlayer(this);
         if (m_private) {
             client().mediaPlayerEngineUpdated();
+            if (m_visible)
+                m_private->setVisible(m_visible);
             m_private->prepareForPlayback(m_privateBrowsing, m_preload, m_preservesPitch, m_shouldPrepareToRender);
         }
     }
@@ -951,20 +953,14 @@
     m_private->setSize(size);
 }
 
-bool MediaPlayer::visible() const
+void MediaPlayer::setVisible(bool visible)
 {
-    return m_visible;
+    m_visible = visible;
+    m_private->setVisible(visible);
 }
 
-void MediaPlayer::setVisible(bool b)
-{
-    m_visible = b;
-    m_private->setVisible(b);
-}
-
 void MediaPlayer::setVisibleForCanvas(bool visible)
 {
-    m_visible = visible;
     m_private->setVisibleForCanvas(visible);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (268969 => 268970)


--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h	2020-10-26 12:42:18 UTC (rev 268970)
@@ -342,7 +342,6 @@
 #endif
     void cancelLoad();
 
-    bool visible() const;
     void setVisible(bool);
     void setVisibleForCanvas(bool);
 

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (268969 => 268970)


--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2020-10-26 12:42:18 UTC (rev 268970)
@@ -106,7 +106,7 @@
 
 MediaPlayerPrivateAVFoundation::MediaRenderingMode MediaPlayerPrivateAVFoundation::preferredRenderingMode() const
 {
-    if (!m_player->visible() || assetStatus() == MediaPlayerAVAssetStatusUnknown)
+    if (!m_visible || assetStatus() == MediaPlayerAVAssetStatusUnknown)
         return MediaRenderingNone;
 
     if (supportsAcceleratedRendering() && m_player->renderingCanBeAccelerated())
@@ -434,7 +434,7 @@
     // AVFoundation will not return true for firstVideoFrameAvailable until
     // an AVPlayerLayer has been added to the AVPlayerItem, so allow video setup
     // here if a video track to trigger allocation of a AVPlayerLayer.
-    return (m_isAllowedToRender || m_cachedHasVideo) && m_readyState >= MediaPlayer::ReadyState::HaveMetadata && m_player->visible();
+    return (m_isAllowedToRender || m_cachedHasVideo) && m_readyState >= MediaPlayer::ReadyState::HaveMetadata && m_visible;
 }
 
 void MediaPlayerPrivateAVFoundation::prepareForRendering()

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (268969 => 268970)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2020-10-26 12:42:18 UTC (rev 268970)
@@ -3120,7 +3120,7 @@
     if (context.paintingDisabled())
         return;
 
-    if (!m_player->visible())
+    if (!m_visible)
         return;
 
     auto sampleLocker = holdLock(m_sampleMutex);

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (268969 => 268970)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2020-10-26 12:42:18 UTC (rev 268970)
@@ -164,7 +164,7 @@
     void setMuted(bool) final;
     MediaPlayer::NetworkState networkState() const final;
     MediaPlayer::ReadyState readyState() const final;
-    void setVisible(bool) final { }
+    void setVisible(bool visible) final { m_visible = visible; }
     void setSize(const IntSize&) final;
     // Prefer MediaTime based methods over float based.
     float duration() const final { return durationMediaTime().toFloat(); }
@@ -502,6 +502,8 @@
     RefPtr<MediaStreamPrivate> m_streamPrivate;
 #endif
 
+    bool m_visible { false };
+
     // playbin3 only:
     bool m_waitingForStreamsSelectedEvent { true };
     AtomString m_currentAudioStreamId; // Currently playing.

Modified: trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (268969 => 268970)


--- trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2020-10-26 12:31:41 UTC (rev 268969)
+++ trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp	2020-10-26 12:42:18 UTC (rev 268970)
@@ -352,7 +352,7 @@
 
 void MediaPlayerPrivateMediaFoundation::paint(GraphicsContext& context, const FloatRect& rect)
 {
-    if (context.paintingDisabled() || !m_player->visible())
+    if (context.paintingDisabled() || !m_visible)
         return;
 
     if (m_presenter)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to