<!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>[151903] 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/151903">151903</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-06-24 02:32:54 -0700 (Mon, 24 Jun 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/151021">r151021</a>.
http://trac.webkit.org/changeset/151021
https://bugs.webkit.org/show_bug.cgi?id=117924

caused regressions on Qt and GTK (#117141 and #117688)
(Requested by philn on #webkit).

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webkit_web_src_init):
(webKitWebSrcFinalize):
(webKitWebSrcSetProperty):
(webKitWebSrcGetProperty):
(webKitWebSrcStop):
(webKitWebSrcStart):
(webKitWebSrcChangeState):
(webKitWebSrcQueryWithParent):
(webKitWebSrcGetUri):
(webKitWebSrcSetUri):
(webKitWebSrcNeedDataMainCb):
(webKitWebSrcEnoughDataMainCb):
(webKitWebSrcSeekMainCb):
(webKitWebSrcSeekDataCb):
(StreamingClient::StreamingClient):
(StreamingClient::~StreamingClient):
(StreamingClient::didReceiveResponse):
(StreamingClient::didReceiveData):
(StreamingClient::didFinishLoading):
(StreamingClient::wasBlocked):
(StreamingClient::cannotShowURL):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerWebKitWebSourceGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (151902 => 151903)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-06-24 09:04:32 UTC (rev 151902)
+++ trunk/Source/WebCore/ChangeLog        2013-06-24 09:32:54 UTC (rev 151903)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2013-06-24  Commit Queue  &lt;commit-queue@webkit.org&gt;
+
+        Unreviewed, rolling out r151021.
+        http://trac.webkit.org/changeset/151021
+        https://bugs.webkit.org/show_bug.cgi?id=117924
+
+        caused regressions on Qt and GTK (#117141 and #117688)
+        (Requested by philn on #webkit).
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webkit_web_src_init):
+        (webKitWebSrcFinalize):
+        (webKitWebSrcSetProperty):
+        (webKitWebSrcGetProperty):
+        (webKitWebSrcStop):
+        (webKitWebSrcStart):
+        (webKitWebSrcChangeState):
+        (webKitWebSrcQueryWithParent):
+        (webKitWebSrcGetUri):
+        (webKitWebSrcSetUri):
+        (webKitWebSrcNeedDataMainCb):
+        (webKitWebSrcEnoughDataMainCb):
+        (webKitWebSrcSeekMainCb):
+        (webKitWebSrcSeekDataCb):
+        (StreamingClient::StreamingClient):
+        (StreamingClient::~StreamingClient):
+        (StreamingClient::didReceiveResponse):
+        (StreamingClient::didReceiveData):
+        (StreamingClient::didFinishLoading):
+        (StreamingClient::wasBlocked):
+        (StreamingClient::cannotShowURL):
+
</ins><span class="cx"> 2013-06-24  Christophe Dumez  &lt;ch.dumez@sisa.samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move IDL implements statements to IDL files that implement the interface
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerWebKitWebSourceGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (151902 => 151903)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp        2013-06-24 09:04:32 UTC (rev 151902)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp        2013-06-24 09:32:54 UTC (rev 151903)
</span><span class="lines">@@ -42,16 +42,6 @@
</span><span class="cx"> #include &lt;wtf/gobject/GRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><del>-/* Premisses:
- * - webkitsrc may be created from any thread inside gstreamer
- * - client holds reference to src, so that src is never deleted while client exists
- * - if the src exists, appsrc also exists
- * - client is created on start
- * - client is deleted on stop after cancelling resource handle
- * - client callbacks are always invoked from main thread
- * - resource handle methods must always be called from main thread
- */
-
</del><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="cx"> class StreamingClient : public ResourceHandleClient {
</span><span class="lines">@@ -94,8 +84,6 @@
</span><span class="cx"> 
</span><span class="cx">     guint64 requestedOffset;
</span><span class="cx"> 
</span><del>-    guint startID;
-    guint stopID;
</del><span class="cx">     guint needDataID;
</span><span class="cx">     guint enoughDataID;
</span><span class="cx">     guint seekID;
</span><span class="lines">@@ -148,6 +136,8 @@
</span><span class="cx"> static void webKitWebSrcEnoughDataCb(GstAppSrc*, gpointer userData);
</span><span class="cx"> static gboolean webKitWebSrcSeekDataCb(GstAppSrc*, guint64 offset, gpointer userData);
</span><span class="cx"> 
</span><ins>+static void webKitWebSrcStop(WebKitWebSrc*, bool);
+
</ins><span class="cx"> static GstAppSrcCallbacks appsrcCallbacks = {
</span><span class="cx">     webKitWebSrcNeedDataCb,
</span><span class="cx">     webKitWebSrcEnoughDataCb,
</span><span class="lines">@@ -239,6 +229,8 @@
</span><span class="cx"> 
</span><span class="cx">     src-&gt;priv = priv;
</span><span class="cx"> 
</span><ins>+    priv-&gt;client = new StreamingClient(src);
+
</ins><span class="cx">     priv-&gt;appsrc = GST_APP_SRC(gst_element_factory_make(&quot;appsrc&quot;, 0));
</span><span class="cx">     if (!priv-&gt;appsrc) {
</span><span class="cx">         GST_ERROR_OBJECT(src, &quot;Failed to create appsrc&quot;);
</span><span class="lines">@@ -287,8 +279,7 @@
</span><span class="cx">     if (priv-&gt;haveAppSrc27)
</span><span class="cx">         g_object_set(priv-&gt;appsrc, &quot;min-percent&quot;, 20, NULL);
</span><span class="cx"> 
</span><del>-    gst_app_src_set_caps(priv-&gt;appsrc, 0);
-    gst_app_src_set_size(priv-&gt;appsrc, -1);
</del><ins>+    webKitWebSrcStop(src, false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webKitWebSrcDispose(GObject* object)
</span><span class="lines">@@ -311,6 +302,8 @@
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><span class="cx"> 
</span><ins>+    delete priv-&gt;client;
+
</ins><span class="cx">     g_free(priv-&gt;uri);
</span><span class="cx"> 
</span><span class="cx">     GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
</span><span class="lines">@@ -323,9 +316,7 @@
</span><span class="cx"> 
</span><span class="cx">     switch (propID) {
</span><span class="cx">     case PROP_IRADIO_MODE:
</span><del>-        GST_OBJECT_LOCK(src);
</del><span class="cx">         priv-&gt;iradioMode = g_value_get_boolean(value);
</span><del>-        GST_OBJECT_UNLOCK(src);
</del><span class="cx">         break;
</span><span class="cx">     case PROP_LOCATION:
</span><span class="cx"> #ifdef GST_API_VERSION_1
</span><span class="lines">@@ -345,7 +336,6 @@
</span><span class="cx">     WebKitWebSrc* src = WEBKIT_WEB_SRC(object);
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
</del><span class="cx">     switch (propID) {
</span><span class="cx">     case PROP_IRADIO_MODE:
</span><span class="cx">         g_value_set_boolean(value, priv-&gt;iradioMode);
</span><span class="lines">@@ -369,35 +359,19 @@
</span><span class="cx">         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-    GST_OBJECT_UNLOCK(src);
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-// must be called on main thread and with object unlocked
-static gboolean webKitWebSrcStop(WebKitWebSrc* src)
</del><ins>+
+static void webKitWebSrcStop(WebKitWebSrc* src, bool seeking)
</ins><span class="cx"> {
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><del>-    gboolean seeking;
</del><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
-
-    seeking = priv-&gt;seekID;
-
-    if (priv-&gt;startID) {
-        g_source_remove(priv-&gt;startID);
-        priv-&gt;startID = 0;
-    }
-
</del><span class="cx">     if (priv-&gt;resourceHandle) {
</span><span class="cx">         priv-&gt;resourceHandle-&gt;cancel();
</span><span class="cx">         priv-&gt;resourceHandle.release();
</span><span class="cx">     }
</span><span class="cx">     priv-&gt;resourceHandle = 0;
</span><span class="cx"> 
</span><del>-    if (priv-&gt;client) {
-        delete priv-&gt;client;
-        priv-&gt;client = 0;
-    }
-
</del><span class="cx">     if (priv-&gt;frame &amp;&amp; !seeking)
</span><span class="cx">         priv-&gt;frame.clear();
</span><span class="cx"> 
</span><span class="lines">@@ -410,6 +384,7 @@
</span><span class="cx">         priv-&gt;buffer.clear();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    GST_OBJECT_LOCK(src);
</ins><span class="cx">     if (priv-&gt;needDataID)
</span><span class="cx">         g_source_remove(priv-&gt;needDataID);
</span><span class="cx">     priv-&gt;needDataID = 0;
</span><span class="lines">@@ -423,6 +398,7 @@
</span><span class="cx">     priv-&gt;seekID = 0;
</span><span class="cx"> 
</span><span class="cx">     priv-&gt;paused = FALSE;
</span><ins>+    GST_OBJECT_UNLOCK(src);
</ins><span class="cx"> 
</span><span class="cx">     g_free(priv-&gt;iradioName);
</span><span class="cx">     priv-&gt;iradioName = 0;
</span><span class="lines">@@ -436,6 +412,12 @@
</span><span class="cx">     g_free(priv-&gt;iradioTitle);
</span><span class="cx">     priv-&gt;iradioTitle = 0;
</span><span class="cx"> 
</span><ins>+    if (priv-&gt;appsrc) {
+        gst_app_src_set_caps(priv-&gt;appsrc, 0);
+        if (!seeking)
+            gst_app_src_set_size(priv-&gt;appsrc, -1);
+    }
+
</ins><span class="cx">     priv-&gt;offset = 0;
</span><span class="cx">     priv-&gt;seekable = FALSE;
</span><span class="cx"> 
</span><span class="lines">@@ -444,33 +426,18 @@
</span><span class="cx">         priv-&gt;requestedOffset = 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    priv-&gt;stopID = 0;
-    GST_OBJECT_UNLOCK(src);
-
-    if (priv-&gt;appsrc) {
-        gst_app_src_set_caps(priv-&gt;appsrc, 0);
-        if (!seeking)
-            gst_app_src_set_size(priv-&gt;appsrc, -1);
-    }
-
</del><span class="cx">     GST_DEBUG_OBJECT(src, &quot;Stopped request&quot;);
</span><del>-
-    return FALSE;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-// must be called on main thread and with object unlocked
-static gboolean webKitWebSrcStart(WebKitWebSrc* src)
</del><ins>+static bool webKitWebSrcStart(WebKitWebSrc* src)
</ins><span class="cx"> {
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
</del><span class="cx">     if (!priv-&gt;uri) {
</span><span class="cx">         GST_ERROR_OBJECT(src, &quot;No URI provided&quot;);
</span><del>-        GST_OBJECT_UNLOCK(src);
-        webKitWebSrcStop(src);
-        return FALSE;
</del><ins>+        return false;
</ins><span class="cx">     }
</span><del>-
</del><ins>+    
</ins><span class="cx">     KURL url = KURL(KURL(), priv-&gt;uri);
</span><span class="cx"> 
</span><span class="cx">     ResourceRequest request(url);
</span><span class="lines">@@ -505,17 +472,15 @@
</span><span class="cx">     // Needed to use DLNA streaming servers
</span><span class="cx">     request.setHTTPHeaderField(&quot;transferMode.dlna&quot;, &quot;Streaming&quot;);
</span><span class="cx"> 
</span><del>-    priv-&gt;client = new StreamingClient(src);
</del><span class="cx">     priv-&gt;resourceHandle = ResourceHandle::create(context, request, priv-&gt;client, false, false);
</span><span class="cx">     if (!priv-&gt;resourceHandle) {
</span><span class="cx">         GST_ERROR_OBJECT(src, &quot;Failed to create ResourceHandle&quot;);
</span><del>-        GST_OBJECT_UNLOCK(src);
-        webKitWebSrcStop(src);
-    } else {
-        GST_OBJECT_UNLOCK(src);
-        GST_DEBUG_OBJECT(src, &quot;Started request&quot;);
</del><ins>+        return false;
</ins><span class="cx">     }
</span><del>-    return FALSE;
</del><ins>+
+    GST_DEBUG_OBJECT(src, &quot;Started request&quot;);
+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static GstStateChangeReturn webKitWebSrcChangeState(GstElement* element, GstStateChange transition)
</span><span class="lines">@@ -546,15 +511,12 @@
</span><span class="cx">     switch (transition) {
</span><span class="cx">     case GST_STATE_CHANGE_READY_TO_PAUSED:
</span><span class="cx">         GST_DEBUG_OBJECT(src, &quot;READY-&gt;PAUSED&quot;);
</span><del>-        GST_OBJECT_LOCK(src);
-        priv-&gt;startID = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, (GSourceFunc) webKitWebSrcStart, gst_object_ref(src), (GDestroyNotify) gst_object_unref);
-        GST_OBJECT_UNLOCK(src);
</del><ins>+        if (!webKitWebSrcStart(src))
+            ret = GST_STATE_CHANGE_FAILURE;
</ins><span class="cx">         break;
</span><span class="cx">     case GST_STATE_CHANGE_PAUSED_TO_READY:
</span><span class="cx">         GST_DEBUG_OBJECT(src, &quot;PAUSED-&gt;READY&quot;);
</span><del>-        GST_OBJECT_LOCK(src);
-        priv-&gt;stopID = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, (GSourceFunc) webKitWebSrcStop, gst_object_ref(src), (GDestroyNotify) gst_object_unref);
-        GST_OBJECT_UNLOCK(src);
</del><ins>+        webKitWebSrcStop(src, false);
</ins><span class="cx">         break;
</span><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="lines">@@ -565,7 +527,7 @@
</span><span class="cx"> 
</span><span class="cx"> static gboolean webKitWebSrcQueryWithParent(GstPad* pad, GstObject* parent, GstQuery* query)
</span><span class="cx"> {
</span><del>-    WebKitWebSrc* src = WEBKIT_WEB_SRC(GST_ELEMENT(parent));
</del><ins>+    WebKitWebSrc* webkitSrc = WEBKIT_WEB_SRC(GST_ELEMENT(parent));
</ins><span class="cx">     gboolean result = FALSE;
</span><span class="cx"> 
</span><span class="cx">     switch (GST_QUERY_TYPE(query)) {
</span><span class="lines">@@ -574,19 +536,15 @@
</span><span class="cx"> 
</span><span class="cx">         gst_query_parse_duration(query, &amp;format, NULL);
</span><span class="cx"> 
</span><del>-        GST_DEBUG_OBJECT(src, &quot;duration query in format %s&quot;, gst_format_get_name(format));
-        GST_OBJECT_LOCK(src);
-        if ((format == GST_FORMAT_BYTES) &amp;&amp; (src-&gt;priv-&gt;size &gt; 0)) {
-            gst_query_set_duration(query, format, src-&gt;priv-&gt;size);
</del><ins>+        GST_DEBUG_OBJECT(webkitSrc, &quot;duration query in format %s&quot;, gst_format_get_name(format));
+        if ((format == GST_FORMAT_BYTES) &amp;&amp; (webkitSrc-&gt;priv-&gt;size &gt; 0)) {
+            gst_query_set_duration(query, format, webkitSrc-&gt;priv-&gt;size);
</ins><span class="cx">             result = TRUE;
</span><span class="cx">         }
</span><del>-        GST_OBJECT_UNLOCK(src);
</del><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case GST_QUERY_URI: {
</span><del>-        GST_OBJECT_LOCK(src);
-        gst_query_set_uri(query, src-&gt;priv-&gt;uri);
-        GST_OBJECT_UNLOCK(src);
</del><ins>+        gst_query_set_uri(query, webkitSrc-&gt;priv-&gt;uri);
</ins><span class="cx">         result = TRUE;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="lines">@@ -627,13 +585,7 @@
</span><span class="cx"> 
</span><span class="cx"> static gchar* webKitWebSrcGetUri(GstURIHandler* handler)
</span><span class="cx"> {
</span><del>-    WebKitWebSrc* src = WEBKIT_WEB_SRC(handler);
-    gchar* ret;
-
-    GST_OBJECT_LOCK(src);
-    ret = g_strdup(src-&gt;priv-&gt;uri);
-    GST_OBJECT_UNLOCK(src);
-    return ret;
</del><ins>+    return g_strdup(WEBKIT_WEB_SRC(handler)-&gt;priv-&gt;uri);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static gboolean webKitWebSrcSetUri(GstURIHandler* handler, const gchar* uri, GError** error)
</span><span class="lines">@@ -646,25 +598,20 @@
</span><span class="cx">         return FALSE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
</del><span class="cx">     g_free(priv-&gt;uri);
</span><span class="cx">     priv-&gt;uri = 0;
</span><span class="cx"> 
</span><del>-    if (!uri) {
-        GST_OBJECT_UNLOCK(src);
</del><ins>+    if (!uri)
</ins><span class="cx">         return TRUE;
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     KURL url(KURL(), uri);
</span><span class="cx"> 
</span><span class="cx">     if (!url.isValid() || !url.protocolIsInHTTPFamily()) {
</span><del>-        GST_OBJECT_UNLOCK(src);
</del><span class="cx">         g_set_error(error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI, &quot;Invalid URI '%s'&quot;, uri);
</span><span class="cx">         return FALSE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     priv-&gt;uri = g_strdup(url.string().utf8().data());
</span><del>-    GST_OBJECT_UNLOCK(src);
</del><span class="cx">     return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -682,13 +629,7 @@
</span><span class="cx"> 
</span><span class="cx"> static const gchar* webKitWebSrcGetUri(GstURIHandler* handler)
</span><span class="cx"> {
</span><del>-    WebKitWebSrc* src = WEBKIT_WEB_SRC(handler);
-    gchar* ret;
-
-    GST_OBJECT_LOCK(src);
-    ret = g_strdup(src-&gt;priv-&gt;uri);
-    GST_OBJECT_UNLOCK(src);
-    return ret;
</del><ins>+    return g_strdup(WEBKIT_WEB_SRC(handler)-&gt;priv-&gt;uri);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static gboolean webKitWebSrcSetUri(GstURIHandler* handler, const gchar* uri)
</span><span class="lines">@@ -701,25 +642,20 @@
</span><span class="cx">         return FALSE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
</del><span class="cx">     g_free(priv-&gt;uri);
</span><span class="cx">     priv-&gt;uri = 0;
</span><span class="cx"> 
</span><del>-    if (!uri) {
-        GST_OBJECT_UNLOCK(src);
</del><ins>+    if (!uri)
</ins><span class="cx">         return TRUE;
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     KURL url(KURL(), uri);
</span><span class="cx"> 
</span><span class="cx">     if (!url.isValid() || !url.protocolIsInHTTPFamily()) {
</span><del>-        GST_OBJECT_UNLOCK(src);
</del><span class="cx">         GST_ERROR_OBJECT(src, &quot;Invalid URI '%s'&quot;, uri);
</span><span class="cx">         return FALSE;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     priv-&gt;uri = g_strdup(url.string().utf8().data());
</span><del>-    GST_OBJECT_UNLOCK(src);
</del><span class="cx">     return TRUE;
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="lines">@@ -740,19 +676,12 @@
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
-    // already stopped
-    if (!priv-&gt;needDataID) {
-        GST_OBJECT_UNLOCK(src);
-        return FALSE;
-    }
</del><ins>+    priv-&gt;resourceHandle-&gt;setDefersLoading(false);
</ins><span class="cx"> 
</span><ins>+    GST_OBJECT_LOCK(src);
</ins><span class="cx">     priv-&gt;paused = FALSE;
</span><span class="cx">     priv-&gt;needDataID = 0;
</span><span class="cx">     GST_OBJECT_UNLOCK(src);
</span><del>-
-    if (priv-&gt;resourceHandle)
-        priv-&gt;resourceHandle-&gt;setDefersLoading(false);
</del><span class="cx">     return FALSE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -777,19 +706,13 @@
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(src);
-    // already stopped
-    if (!priv-&gt;enoughDataID) {
-        GST_OBJECT_UNLOCK(src);
-        return FALSE;
-    }
</del><ins>+    priv-&gt;resourceHandle-&gt;setDefersLoading(true);
</ins><span class="cx"> 
</span><ins>+    GST_OBJECT_LOCK(src);
</ins><span class="cx">     priv-&gt;paused = TRUE;
</span><span class="cx">     priv-&gt;enoughDataID = 0;
</span><span class="cx">     GST_OBJECT_UNLOCK(src);
</span><span class="cx"> 
</span><del>-    if (priv-&gt;resourceHandle)
-        priv-&gt;resourceHandle-&gt;setDefersLoading(true);
</del><span class="cx">     return FALSE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -812,7 +735,7 @@
</span><span class="cx"> 
</span><span class="cx"> static gboolean webKitWebSrcSeekMainCb(WebKitWebSrc* src)
</span><span class="cx"> {
</span><del>-    webKitWebSrcStop(src);
</del><ins>+    webKitWebSrcStop(src, true);
</ins><span class="cx">     webKitWebSrcStart(src);
</span><span class="cx"> 
</span><span class="cx">     return FALSE;
</span><span class="lines">@@ -824,29 +747,23 @@
</span><span class="cx">     WebKitWebSrcPrivate* priv = src-&gt;priv;
</span><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(src, &quot;Seeking to offset: %&quot; G_GUINT64_FORMAT, offset);
</span><del>-    GST_OBJECT_LOCK(src);
-    if (offset == priv-&gt;offset &amp;&amp; priv-&gt;requestedOffset == priv-&gt;offset) {
-        GST_OBJECT_UNLOCK(src);
</del><ins>+    if (offset == priv-&gt;offset &amp;&amp; priv-&gt;requestedOffset == priv-&gt;offset)
</ins><span class="cx">         return TRUE;
</span><del>-    }
</del><span class="cx"> 
</span><del>-    if (!priv-&gt;seekable) {
-        GST_OBJECT_UNLOCK(src);
</del><ins>+    if (!priv-&gt;seekable)
</ins><span class="cx">         return FALSE;
</span><del>-    }
-    if (offset &gt; priv-&gt;size) {
-        GST_OBJECT_UNLOCK(src);
</del><ins>+    if (offset &gt; priv-&gt;size)
</ins><span class="cx">         return FALSE;
</span><del>-    }
</del><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(src, &quot;Doing range-request seek&quot;);
</span><span class="cx">     priv-&gt;requestedOffset = offset;
</span><span class="cx"> 
</span><ins>+    GST_OBJECT_LOCK(src);
</ins><span class="cx">     if (priv-&gt;seekID)
</span><span class="cx">         g_source_remove(priv-&gt;seekID);
</span><span class="cx">     priv-&gt;seekID = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, (GSourceFunc) webKitWebSrcSeekMainCb, gst_object_ref(src), (GDestroyNotify) gst_object_unref);
</span><span class="cx">     GST_OBJECT_UNLOCK(src);
</span><del>-
</del><ins>+    
</ins><span class="cx">     return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -863,51 +780,71 @@
</span><span class="cx">     priv-&gt;player = player;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-StreamingClient::StreamingClient(WebKitWebSrc* src)
-    : m_src(static_cast&lt;WebKitWebSrc*&gt;(gst_object_ref(src)))
</del><ins>+StreamingClient::StreamingClient(WebKitWebSrc* src) : m_src(src)
</ins><span class="cx"> {
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> StreamingClient::~StreamingClient()
</span><span class="cx"> {
</span><del>-    gst_object_unref(m_src);
</del><ins>+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StreamingClient::willSendRequest(ResourceHandle*, ResourceRequest&amp;, const ResourceResponse&amp;)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StreamingClient::didReceiveResponse(ResourceHandle *handle, const ResourceResponse&amp; response)
</del><ins>+void StreamingClient::didReceiveResponse(ResourceHandle*, const ResourceResponse&amp; response)
</ins><span class="cx"> {
</span><span class="cx">     WebKitWebSrcPrivate* priv = m_src-&gt;priv;
</span><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(m_src, &quot;Received response: %d&quot;, response.httpStatusCode());
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(m_src);
-
</del><span class="cx">     // If we seeked we need 206 == PARTIAL_CONTENT
</span><del>-    if (handle != priv-&gt;resourceHandle || (priv-&gt;requestedOffset &amp;&amp; response.httpStatusCode() != 206)) {
-        GST_OBJECT_UNLOCK(m_src);
</del><ins>+    if (priv-&gt;requestedOffset &amp;&amp; response.httpStatusCode() != 206) {
</ins><span class="cx">         GST_ELEMENT_ERROR(m_src, RESOURCE, READ, (0), (0));
</span><span class="cx">         gst_app_src_end_of_stream(priv-&gt;appsrc);
</span><del>-        webKitWebSrcStop(m_src);
</del><ins>+        webKitWebSrcStop(m_src, false);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     long long length = response.expectedContentLength();
</span><del>-    if (length &gt; 0)
</del><ins>+    if (length &gt; 0) {
</ins><span class="cx">         length += priv-&gt;requestedOffset;
</span><ins>+        gst_app_src_set_size(priv-&gt;appsrc, length);
</ins><span class="cx"> 
</span><ins>+#ifndef GST_API_VERSION_1
+        if (!priv-&gt;haveAppSrc27) {
+            gst_segment_set_duration(&amp;GST_BASE_SRC(priv-&gt;appsrc)-&gt;segment, GST_FORMAT_BYTES, length);
+            gst_element_post_message(GST_ELEMENT(priv-&gt;appsrc),
+                                     gst_message_new_duration(GST_OBJECT(priv-&gt;appsrc),
+                                                              GST_FORMAT_BYTES, length));
+        }
+#endif
+    }
+
</ins><span class="cx">     priv-&gt;size = length &gt;= 0 ? length : 0;
</span><span class="cx">     priv-&gt;seekable = length &gt; 0 &amp;&amp; g_ascii_strcasecmp(&quot;none&quot;, response.httpHeaderField(&quot;Accept-Ranges&quot;).utf8().data());
</span><span class="cx"> 
</span><ins>+    // icecast stuff
+    String value = response.httpHeaderField(&quot;icy-metaint&quot;);
+    if (!value.isEmpty()) {
+        gchar* endptr = 0;
+        gint64 icyMetaInt = g_ascii_strtoll(value.utf8().data(), &amp;endptr, 10);
+            
+        if (endptr &amp;&amp; *endptr == '\0' &amp;&amp; icyMetaInt &gt; 0) {
+            GRefPtr&lt;GstCaps&gt; caps = adoptGRef(gst_caps_new_simple(&quot;application/x-icy&quot;, &quot;metadata-interval&quot;, G_TYPE_INT, (gint) icyMetaInt, NULL));
+
+            gst_app_src_set_caps(priv-&gt;appsrc, caps.get());
+        }
+    }
+
</ins><span class="cx"> #ifdef GST_API_VERSION_1
</span><span class="cx">     GstTagList* tags = gst_tag_list_new_empty();
</span><span class="cx"> #else
</span><span class="cx">     GstTagList* tags = gst_tag_list_new();
</span><span class="cx"> #endif
</span><del>-    String value = response.httpHeaderField(&quot;icy-name&quot;);
</del><ins>+    value = response.httpHeaderField(&quot;icy-name&quot;);
</ins><span class="cx">     if (!value.isEmpty()) {
</span><span class="cx">         g_free(priv-&gt;iradioName);
</span><span class="cx">         priv-&gt;iradioName = g_strdup(value.utf8().data());
</span><span class="lines">@@ -936,38 +873,6 @@
</span><span class="cx">         gst_tag_list_add(tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, priv-&gt;iradioTitle, NULL);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    GST_OBJECT_UNLOCK(m_src);
-
-    // notify size/duration
-    if (length &gt; 0) {
-        gst_app_src_set_size(priv-&gt;appsrc, length);
-
-#ifndef GST_API_VERSION_1
-        if (!priv-&gt;haveAppSrc27) {
-            gst_segment_set_duration(&amp;GST_BASE_SRC(priv-&gt;appsrc)-&gt;segment, GST_FORMAT_BYTES, length);
-            gst_element_post_message(GST_ELEMENT(priv-&gt;appsrc),
-                gst_message_new_duration(GST_OBJECT(priv-&gt;appsrc),
-                    GST_FORMAT_BYTES, length));
-        }
-#endif
-    } else
-        gst_app_src_set_size(priv-&gt;appsrc, -1);
-
-    // icecast stuff
-    value = response.httpHeaderField(&quot;icy-metaint&quot;);
-    if (!value.isEmpty()) {
-        gchar* endptr = 0;
-        gint64 icyMetaInt = g_ascii_strtoll(value.utf8().data(), &amp;endptr, 10);
-
-        if (endptr &amp;&amp; *endptr == '\0' &amp;&amp; icyMetaInt &gt; 0) {
-            GRefPtr&lt;GstCaps&gt; caps = adoptGRef(gst_caps_new_simple(&quot;application/x-icy&quot;, &quot;metadata-interval&quot;, G_TYPE_INT, (gint) icyMetaInt, NULL));
-
-            gst_app_src_set_caps(priv-&gt;appsrc, caps.get());
-        }
-    } else
-        gst_app_src_set_caps(priv-&gt;appsrc, 0);
-
-    // notify tags
</del><span class="cx">     if (gst_tag_list_is_empty(tags))
</span><span class="cx"> #ifdef GST_API_VERSION_1
</span><span class="cx">         gst_tag_list_unref(tags);
</span><span class="lines">@@ -975,15 +880,13 @@
</span><span class="cx">         gst_tag_list_free(tags);
</span><span class="cx"> #endif
</span><span class="cx">     else
</span><del>-        notifyGstTagsOnPad(GST_ELEMENT(m_src), priv-&gt;srcpad, tags);
</del><ins>+        notifyGstTagsOnPad(GST_ELEMENT(m_src), m_src-&gt;priv-&gt;srcpad, tags);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StreamingClient::didReceiveData(ResourceHandle* handle, const char* data, int length, int)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSrcPrivate* priv = m_src-&gt;priv;
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(m_src);
-
</del><span class="cx">     GST_LOG_OBJECT(m_src, &quot;Have %d bytes of data&quot;, priv-&gt;buffer ? getGstBufferSize(priv-&gt;buffer.get()) : length);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!priv-&gt;buffer || data == getGstBufferDataPointer(priv-&gt;buffer.get()));
</span><span class="lines">@@ -994,7 +897,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (priv-&gt;seekID || handle != priv-&gt;resourceHandle) {
</span><del>-        GST_OBJECT_UNLOCK(m_src);
</del><span class="cx">         GST_DEBUG_OBJECT(m_src, &quot;Seek in progress, ignoring data&quot;);
</span><span class="cx">         priv-&gt;buffer.clear();
</span><span class="cx">         return;
</span><span class="lines">@@ -1019,8 +921,6 @@
</span><span class="cx">     }
</span><span class="cx">     GST_BUFFER_OFFSET_END(priv-&gt;buffer.get()) = priv-&gt;offset;
</span><span class="cx"> 
</span><del>-    GST_OBJECT_UNLOCK(m_src);
-
</del><span class="cx">     GstFlowReturn ret = gst_app_src_push_buffer(priv-&gt;appsrc, priv-&gt;buffer.leakRef());
</span><span class="cx"> #ifdef GST_API_VERSION_1
</span><span class="cx">     if (ret != GST_FLOW_OK &amp;&amp; ret != GST_FLOW_EOS)
</span><span class="lines">@@ -1054,12 +954,8 @@
</span><span class="cx"> 
</span><span class="cx">     GST_DEBUG_OBJECT(m_src, &quot;Have EOS&quot;);
</span><span class="cx"> 
</span><del>-    GST_OBJECT_LOCK(m_src);
-    if (!priv-&gt;seekID) {
-        GST_OBJECT_UNLOCK(m_src);
</del><ins>+    if (!priv-&gt;seekID)
</ins><span class="cx">         gst_app_src_end_of_stream(m_src-&gt;priv-&gt;appsrc);
</span><del>-    } else
-        GST_OBJECT_UNLOCK(m_src);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StreamingClient::didFail(ResourceHandle*, const ResourceError&amp; error)
</span><span class="lines">@@ -1071,28 +967,14 @@
</span><span class="cx"> 
</span><span class="cx"> void StreamingClient::wasBlocked(ResourceHandle*)
</span><span class="cx"> {
</span><del>-    GOwnPtr&lt;gchar&gt; uri;
-
</del><span class="cx">     GST_ERROR_OBJECT(m_src, &quot;Request was blocked&quot;);
</span><del>-
-    GST_OBJECT_LOCK(m_src);
-    uri.set(g_strdup(m_src-&gt;priv-&gt;uri));
-    GST_OBJECT_UNLOCK(m_src);
-
-    GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, (&quot;Access to \&quot;%s\&quot; was blocked&quot;, uri.get()), (0));
</del><ins>+    GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, (&quot;Access to \&quot;%s\&quot; was blocked&quot;, m_src-&gt;priv-&gt;uri), (0));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void StreamingClient::cannotShowURL(ResourceHandle*)
</span><span class="cx"> {
</span><del>-    GOwnPtr&lt;gchar&gt; uri;
-
</del><span class="cx">     GST_ERROR_OBJECT(m_src, &quot;Cannot show URL&quot;);
</span><del>-
-    GST_OBJECT_LOCK(m_src);
-    uri.set(g_strdup(m_src-&gt;priv-&gt;uri));
-    GST_OBJECT_UNLOCK(m_src);
-
-    GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, (&quot;Can't show \&quot;%s\&quot;&quot;, uri.get()), (0));
</del><ins>+    GST_ELEMENT_ERROR(m_src, RESOURCE, OPEN_READ, (&quot;Can't show \&quot;%s\&quot;&quot;, m_src-&gt;priv-&gt;uri), (0));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(GSTREAMER)
</span></span></pre>
</div>
</div>

</body>
</html>