[GStreamer] The bus synchronous handler should be in the base player class
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jan 2018 11:01:32 +0000 (11:01 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jan 2018 11:01:32 +0000 (11:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=181237

Reviewed by Carlos Garcia Campos.

Because this is where video rendering is handled.

No new tests, this is only a refactoring.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::setPipeline):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226358 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

index 2e90414..48f0ba2 100644 (file)
@@ -1,5 +1,21 @@
 2018-01-03  Philippe Normand  <pnormand@igalia.com>
 
+        [GStreamer] The bus synchronous handler should be in the base player class
+        https://bugs.webkit.org/show_bug.cgi?id=181237
+
+        Reviewed by Carlos Garcia Campos.
+
+        Because this is where video rendering is handled.
+
+        No new tests, this is only a refactoring.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline):
+
+2018-01-03  Philippe Normand  <pnormand@igalia.com>
+
         [GStreamer] move MediaSample implementation out of mse/
         https://bugs.webkit.org/show_bug.cgi?id=179165
 
index 344e88a..833a75b 100644 (file)
@@ -2079,19 +2079,8 @@ void MediaPlayerPrivateGStreamer::createGSTPlayBin()
     setPipeline(gst_element_factory_make("playbin", "play"));
     setStreamVolumeElement(GST_STREAM_VOLUME(m_pipeline.get()));
 
-    GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
-    gst_bus_set_sync_handler(bus.get(), [](GstBus*, GstMessage* message, gpointer userData) {
-        auto& player = *static_cast<MediaPlayerPrivateGStreamer*>(userData);
-
-        if (player.handleSyncMessage(message)) {
-            gst_message_unref(message);
-            return GST_BUS_DROP;
-        }
-
-        return GST_BUS_PASS;
-    }, this, nullptr);
-
     // Let also other listeners subscribe to (application) messages in this bus.
+    GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
     gst_bus_add_signal_watch_full(bus.get(), RunLoopSourcePriority::RunLoopDispatcher);
     g_signal_connect(bus.get(), "message", G_CALLBACK(busMessageCallback), this);
 
index 3ac3dd2..1b15831 100644 (file)
@@ -274,6 +274,18 @@ MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase()
 void MediaPlayerPrivateGStreamerBase::setPipeline(GstElement* pipeline)
 {
     m_pipeline = pipeline;
+
+    GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
+    gst_bus_set_sync_handler(bus.get(), [](GstBus*, GstMessage* message, gpointer userData) {
+        auto& player = *static_cast<MediaPlayerPrivateGStreamerBase*>(userData);
+
+        if (player.handleSyncMessage(message)) {
+            gst_message_unref(message);
+            return GST_BUS_DROP;
+        }
+
+        return GST_BUS_PASS;
+    }, this, nullptr);
 }
 
 #if ENABLE(ENCRYPTED_MEDIA)