Title: [291337] trunk/Source/WebCore
Revision
291337
Author
[email protected]
Date
2022-03-16 03:16:11 -0700 (Wed, 16 Mar 2022)

Log Message

[GStreamer] Avoid auto-selection of hole punching player
https://bugs.webkit.org/show_bug.cgi?id=237828

Reviewed by Xabier Rodriguez-Calvar.

The hole punch player private shouldn't be automatically selected when
the mime type is empty or unsupported by that specific player
("video/holepunch" in practice). This patch returns a FormatError
networkState in those cases, forcing the selection algorithm to
discard the hole punch player private.

This patch is authored by Eugene Mutavchi <[email protected]>
See: https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/797

* platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Implement networkState setter. Set FormatError networkState on load when the mime type is empty or unknown.
* platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Refactor networkState management. Move load() implementation to cpp file.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291336 => 291337)


--- trunk/Source/WebCore/ChangeLog	2022-03-16 10:14:17 UTC (rev 291336)
+++ trunk/Source/WebCore/ChangeLog	2022-03-16 10:16:11 UTC (rev 291337)
@@ -1,3 +1,22 @@
+2022-03-16  Enrique Ocaña González  <[email protected]>
+
+        [GStreamer] Avoid auto-selection of hole punching player
+        https://bugs.webkit.org/show_bug.cgi?id=237828
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        The hole punch player private shouldn't be automatically selected when
+        the mime type is empty or unsupported by that specific player
+        ("video/holepunch" in practice). This patch returns a FormatError
+        networkState in those cases, forcing the selection algorithm to
+        discard the hole punch player private.
+
+        This patch is authored by Eugene Mutavchi <[email protected]>
+        See: https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/797
+
+        * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp: Implement networkState setter. Set FormatError networkState on load when the mime type is empty or unknown.
+        * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: Refactor networkState management. Move load() implementation to cpp file.
+
 2022-03-15  Alan Bujtas  <[email protected]>
 
         REGRESSION (r282737): `text-shadow` is clipped

Modified: trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp (291336 => 291337)


--- trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp	2022-03-16 10:14:17 UTC (rev 291336)
+++ trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.cpp	2022-03-16 10:16:11 UTC (rev 291337)
@@ -33,6 +33,7 @@
 MediaPlayerPrivateHolePunch::MediaPlayerPrivateHolePunch(MediaPlayer* player)
     : m_player(player)
     , m_readyTimer(RunLoop::main(), this, &MediaPlayerPrivateHolePunch::notifyReadyState)
+    , m_networkState(MediaPlayer::NetworkState::Empty)
 #if USE(NICOSIA)
     , m_nicosiaLayer(Nicosia::ContentLayer::create(Nicosia::ContentLayerTextureMapperImpl::createFactory(*this)))
 #else
@@ -171,5 +172,21 @@
     // Notify the ready state so the GraphicsLayer gets created.
     m_player->readyStateChanged();
 }
+
+void MediaPlayerPrivateHolePunch::setNetworkState(MediaPlayer::NetworkState networkState)
+{
+    m_networkState = networkState;
+    m_player->networkStateChanged();
 }
+
+void MediaPlayerPrivateHolePunch::load(const String&)
+{
+    if (!m_player)
+        return;
+
+    auto mimeType = m_player->contentMIMEType();
+    if (mimeType.isEmpty() || !mimeTypeCache().contains(mimeType))
+        setNetworkState(MediaPlayer::NetworkState::FormatError);
+}
+}
 #endif // USE(EXTERNAL_HOLEPUNCH)

Modified: trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h (291336 => 291337)


--- trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h	2022-03-16 10:14:17 UTC (rev 291336)
+++ trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h	2022-03-16 10:16:11 UTC (rev 291337)
@@ -51,7 +51,7 @@
 
     static void registerMediaEngine(MediaEngineRegistrar);
 
-    void load(const String&) final { };
+    void load(const String&) final;
 #if ENABLE(MEDIA_SOURCE)
     void load(const URL&, const ContentType&, MediaSourcePrivateClient*) final { };
 #endif
@@ -76,7 +76,7 @@
 
     bool paused() const final { return false; };
 
-    MediaPlayer::NetworkState networkState() const final { return MediaPlayer::NetworkState::Empty; };
+    MediaPlayer::NetworkState networkState() const final { return m_networkState; };
     MediaPlayer::ReadyState readyState() const final { return MediaPlayer::ReadyState::HaveMetadata; };
 
     std::unique_ptr<PlatformTimeRanges> buffered() const final { return makeUnique<PlatformTimeRanges>(); };
@@ -95,6 +95,7 @@
 
     void pushNextHolePunchBuffer();
     void swapBuffersIfNeeded() final;
+    void setNetworkState(MediaPlayer::NetworkState);
 #if !USE(NICOSIA)
     RefPtr<TextureMapperPlatformLayerProxy> proxy() const final;
 #endif
@@ -109,6 +110,7 @@
     MediaPlayer* m_player;
     IntSize m_size;
     RunLoop::Timer<MediaPlayerPrivateHolePunch> m_readyTimer;
+    MediaPlayer::NetworkState m_networkState;
 #if USE(TEXTURE_MAPPER_GL)
 #if USE(NICOSIA)
     Ref<Nicosia::ContentLayer> m_nicosiaLayer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to