Title: [197863] trunk/Source/WebCore
Revision
197863
Author
[email protected]
Date
2016-03-09 10:26:38 -0800 (Wed, 09 Mar 2016)

Log Message

[GStreamer] Fix MediaPlayerPrivate conflicts
https://bugs.webkit.org/show_bug.cgi?id=155236

Reviewed by Martin Robinson.

In some cases the mediastream player would be used to play
non-mediastream videos or MSE streams. The OWR player should be
used only for mediastreams and the MediaPlayerPrivateGStreamer
player should be used only for normal <video> elements and
MediaSource support.

This patch intends to fix the massive tests timeouts currently
happening on the GTK bots after r197752.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::supportsType): Bail out if
the type checked represents a mediastream.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
Prevent signal disconnection on possible NULL GObjects.
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
(WebCore::MediaPlayerPrivateGStreamerOwr::MediaPlayerPrivateGStreamerOwr):
Simplify constructor to the bare minimum.
(WebCore::MediaPlayerPrivateGStreamerOwr::load): Create sinks only
if needed from the load method.
(WebCore::MediaPlayerPrivateGStreamerOwr::getSupportedTypes):
Initialize the type cache to an empty static hashset.
(WebCore::MediaPlayerPrivateGStreamerOwr::supportsType): This
player does support mediastreams and nothing else.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (197862 => 197863)


--- trunk/Source/WebCore/ChangeLog	2016-03-09 18:10:59 UTC (rev 197862)
+++ trunk/Source/WebCore/ChangeLog	2016-03-09 18:26:38 UTC (rev 197863)
@@ -1,3 +1,36 @@
+2016-03-09  Philippe Normand  <[email protected]>
+
+        [GStreamer] Fix MediaPlayerPrivate conflicts
+        https://bugs.webkit.org/show_bug.cgi?id=155236
+
+        Reviewed by Martin Robinson.
+
+        In some cases the mediastream player would be used to play
+        non-mediastream videos or MSE streams. The OWR player should be
+        used only for mediastreams and the MediaPlayerPrivateGStreamer
+        player should be used only for normal <video> elements and
+        MediaSource support.
+
+        This patch intends to fix the massive tests timeouts currently
+        happening on the GTK bots after r197752.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::supportsType): Bail out if
+        the type checked represents a mediastream.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        Prevent signal disconnection on possible NULL GObjects.
+        (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerOwr::MediaPlayerPrivateGStreamerOwr):
+        Simplify constructor to the bare minimum.
+        (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create sinks only
+        if needed from the load method.
+        (WebCore::MediaPlayerPrivateGStreamerOwr::getSupportedTypes):
+        Initialize the type cache to an empty static hashset.
+        (WebCore::MediaPlayerPrivateGStreamerOwr::supportsType): This
+        player does support mediastreams and nothing else.
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
+
 2016-03-08  Brent Fulgham  <[email protected]>
 
         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked..

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


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2016-03-09 18:10:59 UTC (rev 197862)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2016-03-09 18:26:38 UTC (rev 197863)
@@ -1771,6 +1771,11 @@
 
 MediaPlayer::SupportsType MediaPlayerPrivateGStreamer::supportsType(const MediaEngineSupportParameters& parameters)
 {
+    // MediaStream playback is handled by the OpenWebRTC player.
+    if (parameters.isMediaStream)
+        return MediaPlayer::IsNotSupported;
+
+
     if (parameters.type.isNull() || parameters.type.isEmpty())
         return MediaPlayer::IsNotSupported;
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (197862 => 197863)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2016-03-09 18:10:59 UTC (rev 197862)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp	2016-03-09 18:26:38 UTC (rev 197863)
@@ -181,13 +181,15 @@
 {
     m_notifier.cancelPendingNotifications();
 
-    g_signal_handlers_disconnect_matched(m_videoSink.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
+    if (m_videoSink)
+        g_signal_handlers_disconnect_matched(m_videoSink.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
 
     g_mutex_clear(&m_sampleMutex);
 
     m_player = nullptr;
 
-    g_signal_handlers_disconnect_matched(m_volumeElement.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
+    if (m_volumeElement)
+        g_signal_handlers_disconnect_matched(m_volumeElement.get(), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, this);
 
 #if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)
     if (client())

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp (197862 => 197863)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp	2016-03-09 18:10:59 UTC (rev 197862)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp	2016-03-09 18:26:38 UTC (rev 197863)
@@ -34,6 +34,7 @@
 #include <owr/owr.h>
 #include <owr/owr_gst_audio_renderer.h>
 #include <owr/owr_gst_video_renderer.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/text/CString.h>
 
 GST_DEBUG_CATEGORY(webkit_openwebrtc_debug);
@@ -44,12 +45,7 @@
 MediaPlayerPrivateGStreamerOwr::MediaPlayerPrivateGStreamerOwr(MediaPlayer* player)
     : MediaPlayerPrivateGStreamerBase(player)
 {
-    if (initializeGStreamerAndGStreamerDebugging()) {
-        LOG_MEDIA_MESSAGE("Creating MediaPlayerPrivateGStreamerOwr");
-
-        createVideoSink();
-        createGSTAudioSinkBin();
-    }
+    initializeGStreamerAndGStreamerDebugging();
 }
 
 MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr()
@@ -117,14 +113,31 @@
 
 void MediaPlayerPrivateGStreamerOwr::load(const String &)
 {
-    notImplemented();
+    // Properly fail so the global MediaPlayer tries to fallback to the next MediaPlayerPrivate.
+    m_networkState = MediaPlayer::FormatError;
+    m_player->networkStateChanged();
 }
 
+#if ENABLE(MEDIA_SOURCE)
+void MediaPlayerPrivateGStreamerOwr::load(const String&, MediaSourcePrivateClient*)
+{
+    // Properly fail so the global MediaPlayer tries to fallback to the next MediaPlayerPrivate.
+    m_networkState = MediaPlayer::FormatError;
+    m_player->networkStateChanged();
+}
+#endif
+
 void MediaPlayerPrivateGStreamerOwr::load(MediaStreamPrivate& streamPrivate)
 {
     if (!initializeGStreamer())
         return;
 
+    if (!m_videoSink)
+        createVideoSink();
+
+    if (!m_audioSink)
+        createGSTAudioSinkBin();
+
     LOG_MEDIA_MESSAGE("Loading MediaStreamPrivate %p", &streamPrivate);
 
     m_streamPrivate = &streamPrivate;
@@ -243,13 +256,17 @@
     }
 }
 
-void MediaPlayerPrivateGStreamerOwr::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>&)
+void MediaPlayerPrivateGStreamerOwr::getSupportedTypes(HashSet<String, ASCIICaseInsensitiveHash>& types)
 {
     // Not supported in this media player.
+    static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>> cache;
+    types = cache;
 }
 
-MediaPlayer::SupportsType MediaPlayerPrivateGStreamerOwr::supportsType(const MediaEngineSupportParameters&)
+MediaPlayer::SupportsType MediaPlayerPrivateGStreamerOwr::supportsType(const MediaEngineSupportParameters& parameters)
 {
+    if (parameters.isMediaStream)
+        return MediaPlayer::IsSupported;
     return MediaPlayer::IsNotSupported;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h (197862 => 197863)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h	2016-03-09 18:10:59 UTC (rev 197862)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h	2016-03-09 18:26:38 UTC (rev 197863)
@@ -49,7 +49,7 @@
 
     void load(const String&) override;
 #if ENABLE(MEDIA_SOURCE)
-    void load(const String&, MediaSourcePrivateClient*) override { }
+    void load(const String&, MediaSourcePrivateClient*) override;
 #endif
     void load(MediaStreamPrivate&) override;
     void cancelLoad() override { }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to