<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[191948] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/191948">191948</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-03 02:43:52 -0800 (Tue, 03 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GStreamer] Use GstBus sync message handler and schedule tasks to the main thread with RunLoop::dispatch
https://bugs.webkit.org/show_bug.cgi?id=150800
Reviewed by Philippe Normand.
This way we would avoid all the GScource + polling mechanism that
GST uses internally to handle messages asynchronously in the main thread.
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::adoptGRef):
(WTF::refGPtr<GstMessage>):
(WTF::derefGPtr<GstMessage>):
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
Initialize the WeakPtr factory.
(WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
reset the GstBus sync handler.
(WebCore::MediaPlayerPrivateGStreamer::handleMessage): Make it void.
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Add a
GstBus sync message handler and schedule the messages to the main
thread with RunLoop::main().dispatch().
(WebCore::mediaPlayerPrivateMessageCallback): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Create a WeakPtr.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
Handle the need context message that needs to be handled in the
caller thread.
(WebCore::mediaPlayerPrivateNeedContextMessageCallback): Deleted.
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
(WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): Do not
connect to sync-message signal, handleSyncMessage() will be called
to handled messages synchronously.
(WebCore::MediaPlayerPrivateGStreamerBase::handleNeedContextMessage): Deleted.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerGRefPtrGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerGRefPtrGStreamerh">trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerh">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/ChangeLog        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -1,5 +1,44 @@
</span><span class="cx"> 2015-11-03 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [GStreamer] Use GstBus sync message handler and schedule tasks to the main thread with RunLoop::dispatch
+ https://bugs.webkit.org/show_bug.cgi?id=150800
+
+ Reviewed by Philippe Normand.
+
+ This way we would avoid all the GScource + polling mechanism that
+ GST uses internally to handle messages asynchronously in the main thread.
+
+ * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
+ (WTF::adoptGRef):
+ (WTF::refGPtr<GstMessage>):
+ (WTF::derefGPtr<GstMessage>):
+ * platform/graphics/gstreamer/GRefPtrGStreamer.h:
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
+ Initialize the WeakPtr factory.
+ (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
+ reset the GstBus sync handler.
+ (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Make it void.
+ (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Add a
+ GstBus sync message handler and schedule the messages to the main
+ thread with RunLoop::main().dispatch().
+ (WebCore::mediaPlayerPrivateMessageCallback): Deleted.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+ (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Create a WeakPtr.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
+ Handle the need context message that needs to be handled in the
+ caller thread.
+ (WebCore::mediaPlayerPrivateNeedContextMessageCallback): Deleted.
+ (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
+ (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline): Do not
+ connect to sync-message signal, handleSyncMessage() will be called
+ to handled messages synchronously.
+ (WebCore::MediaPlayerPrivateGStreamerBase::handleNeedContextMessage): Deleted.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+
+2015-11-03 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GStreamer] Cleanup the iradio properties
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=148522
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerGRefPtrGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -259,6 +259,25 @@
</span><span class="cx"> gst_toc_unref(ptr);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template<> GRefPtr<GstMessage> adoptGRef(GstMessage* ptr)
+{
+ return GRefPtr<GstMessage>(ptr, GRefPtrAdopt);
+}
+
+template<> GstMessage* refGPtr<GstMessage>(GstMessage* ptr)
+{
+ if (ptr)
+ return gst_message_ref(ptr);
+
+ return ptr;
+}
+
+template<> void derefGPtr<GstMessage>(GstMessage* ptr)
+{
+ if (ptr)
+ gst_message_unref(ptr);
+}
+
</ins><span class="cx"> template <> GRefPtr<WebKitVideoSink> adoptGRef(WebKitVideoSink* ptr)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!ptr || !g_object_is_floating(G_OBJECT(ptr)));
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerGRefPtrGStreamerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> typedef struct _GstTagList GstTagList;
</span><span class="cx"> typedef struct _GstEvent GstEvent;
</span><span class="cx"> typedef struct _GstToc GstToc;
</span><ins>+typedef struct _GstMessage GstMessage;
</ins><span class="cx"> typedef struct _WebKitVideoSink WebKitVideoSink;
</span><span class="cx"> typedef struct _WebKitWebSrc WebKitWebSrc;
</span><span class="cx">
</span><span class="lines">@@ -88,6 +89,10 @@
</span><span class="cx"> template<> GstToc* refGPtr<GstToc>(GstToc* ptr);
</span><span class="cx"> template<> void derefGPtr<GstToc>(GstToc* ptr);
</span><span class="cx">
</span><ins>+template<> GRefPtr<GstMessage> adoptGRef(GstMessage*);
+template<> GstMessage* refGPtr<GstMessage>(GstMessage*);
+template<> void derefGPtr<GstMessage>(GstMessage*);
+
</ins><span class="cx"> template<> GRefPtr<WebKitVideoSink> adoptGRef(WebKitVideoSink* ptr);
</span><span class="cx"> template<> WebKitVideoSink* refGPtr<WebKitVideoSink>(WebKitVideoSink* ptr);
</span><span class="cx"> template<> void derefGPtr<WebKitVideoSink>(WebKitVideoSink* ptr);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include <limits>
</span><span class="cx"> #include <wtf/HexNumber.h>
</span><span class="cx"> #include <wtf/MediaTime.h>
</span><ins>+#include <wtf/RunLoop.h>
</ins><span class="cx"> #include <wtf/glib/GUniquePtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span><span class="lines">@@ -80,11 +81,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-static gboolean mediaPlayerPrivateMessageCallback(GstBus*, GstMessage* message, MediaPlayerPrivateGStreamer* player)
-{
- return player->handleMessage(message);
-}
-
</del><span class="cx"> static void mediaPlayerPrivateSourceChangedCallback(GObject*, GParamSpec*, MediaPlayerPrivateGStreamer* player)
</span><span class="cx"> {
</span><span class="cx"> player->sourceChanged();
</span><span class="lines">@@ -174,6 +170,7 @@
</span><span class="cx">
</span><span class="cx"> MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer(MediaPlayer* player)
</span><span class="cx"> : MediaPlayerPrivateGStreamerBase(player)
</span><ins>+ , m_weakPtrFactory(this)
</ins><span class="cx"> , m_source(0)
</span><span class="cx"> , m_seekTime(0)
</span><span class="cx"> , m_changingRate(false)
</span><span class="lines">@@ -247,8 +244,7 @@
</span><span class="cx"> if (m_pipeline) {
</span><span class="cx"> GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
</span><span class="cx"> ASSERT(bus);
</span><del>- g_signal_handlers_disconnect_by_func(bus.get(), reinterpret_cast<gpointer>(mediaPlayerPrivateMessageCallback), this);
- gst_bus_remove_signal_watch(bus.get());
</del><ins>+ gst_bus_set_sync_handler(bus.get(), nullptr, nullptr, nullptr);
</ins><span class="cx">
</span><span class="cx"> g_signal_handlers_disconnect_by_func(m_pipeline.get(), reinterpret_cast<gpointer>(mediaPlayerPrivateSourceChangedCallback), this);
</span><span class="cx"> g_signal_handlers_disconnect_by_func(m_pipeline.get(), reinterpret_cast<gpointer>(mediaPlayerPrivateVideoChangedCallback), this);
</span><span class="lines">@@ -905,7 +901,7 @@
</span><span class="cx"> return timeRanges;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-gboolean MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
</del><ins>+void MediaPlayerPrivateGStreamer::handleMessage(GstMessage* message)
</ins><span class="cx"> {
</span><span class="cx"> GUniqueOutPtr<GError> err;
</span><span class="cx"> GUniqueOutPtr<gchar> debug;
</span><span class="lines">@@ -924,7 +920,7 @@
</span><span class="cx"> // notify of the new location(s) of the media.
</span><span class="cx"> if (!g_strcmp0(messageTypeName, "redirect")) {
</span><span class="cx"> mediaLocationChanged(message);
</span><del>- return TRUE;
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1065,7 +1061,7 @@
</span><span class="cx"> GST_MESSAGE_TYPE_NAME(message));
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- return TRUE;
</del><ins>+ return;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaPlayerPrivateGStreamer::processBufferingStats(GstMessage* message)
</span><span class="lines">@@ -1938,9 +1934,25 @@
</span><span class="cx"> setStreamVolumeElement(GST_STREAM_VOLUME(m_pipeline.get()));
</span><span class="cx">
</span><span class="cx"> GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
</span><del>- gst_bus_add_signal_watch(bus.get());
- g_signal_connect(bus.get(), "message", G_CALLBACK(mediaPlayerPrivateMessageCallback), this);
</del><ins>+ gst_bus_set_sync_handler(bus.get(), [](GstBus*, GstMessage* message, gpointer userData) {
+ auto& player = *static_cast<MediaPlayerPrivateGStreamer*>(userData);
</ins><span class="cx">
</span><ins>+ if (!player.handleSyncMessage(message)) {
+ if (isMainThread())
+ player.handleMessage(message);
+ else {
+ GRefPtr<GstMessage> protectMessage(message);
+ auto weakThis = player.createWeakPtr();
+ RunLoop::main().dispatch([weakThis, protectMessage] {
+ if (weakThis)
+ weakThis->handleMessage(protectMessage.get());
+ });
+ }
+ }
+ gst_message_unref(message);
+ return GST_BUS_DROP;
+ }, this, nullptr);
+
</ins><span class="cx"> g_object_set(m_pipeline.get(), "mute", m_player->muted(), nullptr);
</span><span class="cx">
</span><span class="cx"> g_signal_connect(m_pipeline.get(), "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include <gst/gst.h>
</span><span class="cx"> #include <gst/pbutils/install-plugins.h>
</span><span class="cx"> #include <wtf/Forward.h>
</span><ins>+#include <wtf/WeakPtr.h>
</ins><span class="cx"> #include <wtf/glib/GThreadSafeMainLoopSource.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK) && USE(GSTREAMER_MPEGTS)
</span><span class="lines">@@ -67,7 +68,7 @@
</span><span class="cx"> ~MediaPlayerPrivateGStreamer();
</span><span class="cx">
</span><span class="cx"> static void registerMediaEngine(MediaEngineRegistrar);
</span><del>- gboolean handleMessage(GstMessage*);
</del><ins>+ void handleMessage(GstMessage*);
</ins><span class="cx"> void handlePluginInstallerResult(GstInstallPluginsReturn);
</span><span class="cx">
</span><span class="cx"> bool hasVideo() const override { return m_hasVideo; }
</span><span class="lines">@@ -147,6 +148,8 @@
</span><span class="cx">
</span><span class="cx"> static bool isAvailable();
</span><span class="cx">
</span><ins>+ WeakPtr<MediaPlayerPrivateGStreamer> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
+
</ins><span class="cx"> GstElement* createAudioSink() override;
</span><span class="cx">
</span><span class="cx"> float playbackPosition() const;
</span><span class="lines">@@ -172,7 +175,6 @@
</span><span class="cx"> bool doSeek(gint64 position, float rate, GstSeekFlags seekType);
</span><span class="cx"> void updatePlaybackRate();
</span><span class="cx">
</span><del>-
</del><span class="cx"> String engineDescription() const override { return "GStreamer"; }
</span><span class="cx"> bool isLiveStream() const override { return m_isStreaming; }
</span><span class="cx"> bool didPassCORSAccessCheck() const override;
</span><span class="lines">@@ -186,7 +188,8 @@
</span><span class="cx"> MediaTime totalFrameDelay() override { return MediaTime::zeroTime(); }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-private:
</del><ins>+ WeakPtrFactory<MediaPlayerPrivateGStreamer> m_weakPtrFactory;
+
</ins><span class="cx"> GRefPtr<GstElement> m_source;
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> GRefPtr<GstElement> m_textAppSink;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -128,11 +128,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-static void mediaPlayerPrivateNeedContextMessageCallback(GstBus*, GstMessage* message, MediaPlayerPrivateGStreamerBase* player)
-{
- player->handleNeedContextMessage(message);
-}
-
</del><span class="cx"> MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase(MediaPlayer* player)
</span><span class="cx"> : m_player(player)
</span><span class="cx"> , m_fpsSink(0)
</span><span class="lines">@@ -179,8 +174,6 @@
</span><span class="cx"> if (m_pipeline) {
</span><span class="cx"> GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
</span><span class="cx"> ASSERT(bus);
</span><del>- g_signal_handlers_disconnect_by_func(bus.get(), reinterpret_cast<gpointer>(mediaPlayerPrivateNeedContextMessageCallback), this);
- gst_bus_disable_sync_message_emission(bus.get());
</del><span class="cx"> m_pipeline.clear();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -193,26 +186,25 @@
</span><span class="cx"> void MediaPlayerPrivateGStreamerBase::setPipeline(GstElement* pipeline)
</span><span class="cx"> {
</span><span class="cx"> m_pipeline = pipeline;
</span><del>-
- GRefPtr<GstBus> bus = adoptGRef(gst_pipeline_get_bus(GST_PIPELINE(m_pipeline.get())));
- gst_bus_enable_sync_message_emission(bus.get());
- g_signal_connect(bus.get(), "sync-message::need-context", G_CALLBACK(mediaPlayerPrivateNeedContextMessageCallback), this);
</del><span class="cx"> }
</span><span class="cx">
</span><del>-void MediaPlayerPrivateGStreamerBase::handleNeedContextMessage(GstMessage* message)
</del><ins>+bool MediaPlayerPrivateGStreamerBase::handleSyncMessage(GstMessage* message)
</ins><span class="cx"> {
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span><ins>+ if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_NEED_CONTEXT)
+ return false;
+
</ins><span class="cx"> const gchar* contextType;
</span><span class="cx"> gst_message_parse_context_type(message, &contextType);
</span><span class="cx">
</span><span class="cx"> if (!ensureGstGLContext())
</span><del>- return;
</del><ins>+ return false;
</ins><span class="cx">
</span><span class="cx"> if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) {
</span><span class="cx"> GstContext* displayContext = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
</span><span class="cx"> gst_context_set_gl_display(displayContext, m_glDisplay.get());
</span><span class="cx"> gst_element_set_context(GST_ELEMENT(message->src), displayContext);
</span><del>- return;
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!g_strcmp0(contextType, "gst.gl.app_context")) {
</span><span class="lines">@@ -220,11 +212,13 @@
</span><span class="cx"> GstStructure* structure = gst_context_writable_structure(appContext);
</span><span class="cx"> gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, m_glContext.get(), nullptr);
</span><span class="cx"> gst_element_set_context(GST_ELEMENT(message->src), appContext);
</span><del>- return;
</del><ins>+ return true;
</ins><span class="cx"> }
</span><span class="cx"> #else
</span><span class="cx"> UNUSED_PARAM(message);
</span><span class="cx"> #endif // USE(GSTREAMER_GL)
</span><ins>+
+ return false;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (191947 => 191948)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2015-11-03 10:40:06 UTC (rev 191947)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2015-11-03 10:43:52 UTC (rev 191948)
</span><span class="lines">@@ -66,7 +66,6 @@
</span><span class="cx"> #if USE(GSTREAMER_GL)
</span><span class="cx"> bool ensureGstGLContext();
</span><span class="cx"> #endif
</span><del>- void handleNeedContextMessage(GstMessage*);
</del><span class="cx">
</span><span class="cx"> bool supportsMuting() const { return true; }
</span><span class="cx"> void setMuted(bool);
</span><span class="lines">@@ -121,6 +120,8 @@
</span><span class="cx">
</span><span class="cx"> void setPipeline(GstElement*);
</span><span class="cx">
</span><ins>+ virtual bool handleSyncMessage(GstMessage*);
+
</ins><span class="cx"> MediaPlayer* m_player;
</span><span class="cx"> GRefPtr<GstElement> m_pipeline;
</span><span class="cx"> GRefPtr<GstStreamVolume> m_volumeElement;
</span></span></pre>
</div>
</div>
</body>
</html>