<!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>[159945] 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/159945">159945</a></dd>
<dt>Author</dt> <dd>vjaquez@igalia.com</dd>
<dt>Date</dt> <dd>2013-12-02 11:55:30 -0800 (Mon, 02 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify MediaPlayerPrivateGStreamerBase::createVideoSink()
https://bugs.webkit.org/show_bug.cgi?id=125077

Remove the method's unused parameter.
Remove the GStreamer 0.10.22 run-time validation, since we are using
GStreamer 1.0 officially.
Remove the creation of a spurious Bin for the video sink, since
either the fpssink or the webkitsink are valid sink elements.
Change fpsink to a GRefPtr.

Now, createVideoSink() returns a simple pointer to the created sink
element.

Reviewed by Philippe Normand.

No new tests, no behavior changes.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
(WebCore::MediaPlayerPrivateGStreamerBase::decodedFrameCount):
(WebCore::MediaPlayerPrivateGStreamerBase::droppedFrameCount):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp</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 (159944 => 159945)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-02 19:50:51 UTC (rev 159944)
+++ trunk/Source/WebCore/ChangeLog        2013-12-02 19:55:30 UTC (rev 159945)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2013-12-02  Víctor Manuel Jáquez Leal  &lt;vjaquez@igalia.com&gt;
+
+        Simplify MediaPlayerPrivateGStreamerBase::createVideoSink()
+        https://bugs.webkit.org/show_bug.cgi?id=125077
+
+        Remove the method's unused parameter.
+        Remove the GStreamer 0.10.22 run-time validation, since we are using
+        GStreamer 1.0 officially.
+        Remove the creation of a spurious Bin for the video sink, since
+        either the fpssink or the webkitsink are valid sink elements.
+        Change fpsink to a GRefPtr.
+
+        Now, createVideoSink() returns a simple pointer to the created sink
+        element.
+
+        Reviewed by Philippe Normand.
+
+        No new tests, no behavior changes.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink):
+        (WebCore::MediaPlayerPrivateGStreamerBase::decodedFrameCount):
+        (WebCore::MediaPlayerPrivateGStreamerBase::droppedFrameCount):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+
</ins><span class="cx"> 2013-12-02  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for WebCrypto RSA-OAEP
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (159944 => 159945)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp        2013-12-02 19:50:51 UTC (rev 159944)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp        2013-12-02 19:55:30 UTC (rev 159945)
</span><span class="lines">@@ -1890,10 +1890,8 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    createVideoSink(m_playBin.get());
</del><ins>+    g_object_set(m_playBin.get(), &quot;video-sink&quot;, createVideoSink(), nullptr);
</ins><span class="cx"> 
</span><del>-    g_object_set(m_playBin.get(), &quot;video-sink&quot;, m_videoSinkBin.get(), nullptr);
-
</del><span class="cx">     GRefPtr&lt;GstPad&gt; videoSinkPad = adoptGRef(gst_element_get_static_pad(m_webkitVideoSink.get(), &quot;sink&quot;));
</span><span class="cx">     if (videoSinkPad)
</span><span class="cx">         g_signal_connect(videoSinkPad.get(), &quot;notify::caps&quot;, G_CALLBACK(mediaPlayerPrivateVideoSinkCapsChangedCallback), this);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (159944 => 159945)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2013-12-02 19:50:51 UTC (rev 159944)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2013-12-02 19:55:30 UTC (rev 159945)
</span><span class="lines">@@ -462,57 +462,41 @@
</span><span class="cx">     return currentCaps;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaPlayerPrivateGStreamerBase::createVideoSink(GstElement* pipeline)
</del><ins>+GstElement* MediaPlayerPrivateGStreamerBase::createVideoSink()
</ins><span class="cx"> {
</span><del>-    if (!initializeGStreamer())
-        return;
</del><ins>+    ASSERT(initializeGStreamer());
</ins><span class="cx"> 
</span><del>-    UNUSED_PARAM(pipeline);
</del><ins>+    GstElement* videoSink = nullptr;
</ins><span class="cx">     m_webkitVideoSink = webkitVideoSinkNew();
</span><span class="cx"> 
</span><span class="cx">     m_repaintHandler = g_signal_connect(m_webkitVideoSink.get(), &quot;repaint-requested&quot;, G_CALLBACK(mediaPlayerPrivateRepaintCallback), this);
</span><span class="cx"> 
</span><del>-    m_videoSinkBin = gst_bin_new(nullptr);
-
-    GstElement* videoSink = nullptr;
</del><span class="cx">     m_fpsSink = gst_element_factory_make(&quot;fpsdisplaysink&quot;, &quot;sink&quot;);
</span><span class="cx">     if (m_fpsSink) {
</span><del>-        // The verbose property has been added in -bad 0.10.22. Making
-        // this whole code depend on it because we don't want
-        // fpsdiplaysink to spit data on stdout.
-        GstElementFactory* factory = GST_ELEMENT_FACTORY(GST_ELEMENT_GET_CLASS(m_fpsSink)-&gt;elementfactory);
-        if (gst_plugin_feature_check_version(GST_PLUGIN_FEATURE(factory), 0, 10, 22)) {
-            g_object_set(m_fpsSink, &quot;silent&quot;, TRUE , nullptr);
</del><ins>+        g_object_set(m_fpsSink.get(), &quot;silent&quot;, TRUE , nullptr);
</ins><span class="cx"> 
</span><del>-            // Turn off text overlay unless logging is enabled.
</del><ins>+        // Turn off text overlay unless logging is enabled.
</ins><span class="cx"> #if LOG_DISABLED
</span><del>-            g_object_set(m_fpsSink, &quot;text-overlay&quot;, FALSE , nullptr);
</del><ins>+        g_object_set(m_fpsSink.get(), &quot;text-overlay&quot;, FALSE , nullptr);
</ins><span class="cx"> #else
</span><del>-            WTFLogChannel* channel = logChannelByName(&quot;Media&quot;);
-            if (channel-&gt;state != WTFLogChannelOn)
-                g_object_set(m_fpsSink, &quot;text-overlay&quot;, FALSE , nullptr);
</del><ins>+        WTFLogChannel* channel = logChannelByName(&quot;Media&quot;);
+        if (channel-&gt;state != WTFLogChannelOn)
+            g_object_set(m_fpsSink.get(), &quot;text-overlay&quot;, FALSE , nullptr);
</ins><span class="cx"> #endif // LOG_DISABLED
</span><span class="cx"> 
</span><del>-            if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink), &quot;video-sink&quot;)) {
-                g_object_set(m_fpsSink, &quot;video-sink&quot;, m_webkitVideoSink.get(), nullptr);
-                gst_bin_add(GST_BIN(m_videoSinkBin.get()), m_fpsSink);
-                videoSink = m_fpsSink;
-            } else
-                m_fpsSink = nullptr;
</del><ins>+        if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_fpsSink.get()), &quot;video-sink&quot;)) {
+            g_object_set(m_fpsSink.get(), &quot;video-sink&quot;, m_webkitVideoSink.get(), nullptr);
+            videoSink = m_fpsSink.get();
</ins><span class="cx">         } else
</span><span class="cx">             m_fpsSink = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_fpsSink) {
-        gst_bin_add(GST_BIN(m_videoSinkBin.get()), m_webkitVideoSink.get());
</del><ins>+    if (!m_fpsSink)
</ins><span class="cx">         videoSink = m_webkitVideoSink.get();
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     ASSERT(videoSink);
</span><span class="cx"> 
</span><del>-    GstElement* firstChild = videoSink;
-    GRefPtr&lt;GstPad&gt; pad = adoptGRef(gst_element_get_static_pad(firstChild, &quot;sink&quot;));
-    gst_element_add_pad(m_videoSinkBin.get(), gst_ghost_pad_new(&quot;sink&quot;, pad.get()));
</del><ins>+    return videoSink;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MediaPlayerPrivateGStreamerBase::setStreamVolumeElement(GstStreamVolume* volume)
</span><span class="lines">@@ -539,7 +523,7 @@
</span><span class="cx"> {
</span><span class="cx">     guint64 decodedFrames = 0;
</span><span class="cx">     if (m_fpsSink)
</span><del>-        g_object_get(m_fpsSink, &quot;frames-rendered&quot;, &amp;decodedFrames, NULL);
</del><ins>+        g_object_get(m_fpsSink.get(), &quot;frames-rendered&quot;, &amp;decodedFrames, NULL);
</ins><span class="cx">     return static_cast&lt;unsigned&gt;(decodedFrames);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -547,7 +531,7 @@
</span><span class="cx"> {
</span><span class="cx">     guint64 framesDropped = 0;
</span><span class="cx">     if (m_fpsSink)
</span><del>-        g_object_get(m_fpsSink, &quot;frames-dropped&quot;, &amp;framesDropped, NULL);
</del><ins>+        g_object_get(m_fpsSink.get(), &quot;frames-dropped&quot;, &amp;framesDropped, NULL);
</ins><span class="cx">     return static_cast&lt;unsigned&gt;(framesDropped);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (159944 => 159945)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2013-12-02 19:50:51 UTC (rev 159944)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2013-12-02 19:55:30 UTC (rev 159945)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     MediaPlayerPrivateGStreamerBase(MediaPlayer*);
</span><del>-    void createVideoSink(GstElement* pipeline);
</del><ins>+    GstElement* createVideoSink();
</ins><span class="cx">     void setStreamVolumeElement(GstStreamVolume*);
</span><span class="cx">     virtual GstElement* audioSink() const { return 0; }
</span><span class="cx">     GRefPtr&lt;GstCaps&gt; currentVideoSinkCaps() const;
</span><span class="lines">@@ -111,8 +111,7 @@
</span><span class="cx">     MediaPlayer* m_player;
</span><span class="cx">     GRefPtr&lt;GstStreamVolume&gt; m_volumeElement;
</span><span class="cx">     GRefPtr&lt;GstElement&gt; m_webkitVideoSink;
</span><del>-    GRefPtr&lt;GstElement&gt; m_videoSinkBin;
-    GstElement* m_fpsSink;
</del><ins>+    GRefPtr&lt;GstElement&gt; m_fpsSink;
</ins><span class="cx">     MediaPlayer::ReadyState m_readyState;
</span><span class="cx">     MediaPlayer::NetworkState m_networkState;
</span><span class="cx">     IntSize m_size;
</span></span></pre>
</div>
</div>

</body>
</html>