souphttpsrc: fix metadata writable warnings
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 11 Mar 2010 15:24:20 +0000 (15:24 +0000)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 11 Mar 2010 15:25:55 +0000 (15:25 +0000)
Set metadata on buffer first, when the refcount is still 1, and only
ref again afterwards.

ext/soup/gstsouphttpsrc.c

index c50fd3e..f182ec9 100644 (file)
@@ -1004,7 +1004,7 @@ gst_soup_http_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk,
 
   /* Extract the GstBuffer from the SoupBuffer and set its fields. */
   *src->outbuf = GST_BUFFER_CAST (soup_buffer_get_owner (chunk));
-  gst_buffer_ref (*src->outbuf);
+
   GST_BUFFER_SIZE (*src->outbuf) = chunk->length;
   GST_BUFFER_OFFSET (*src->outbuf) = basesrc->segment.last_stop;
 
@@ -1012,6 +1012,8 @@ gst_soup_http_src_got_chunk_cb (SoupMessage * msg, SoupBuffer * chunk,
       (src->src_caps) ? src->src_caps :
       GST_PAD_CAPS (GST_BASE_SRC_PAD (basesrc)));
 
+  gst_buffer_ref (*src->outbuf);
+
   new_position = src->read_position + chunk->length;
   if (G_LIKELY (src->request_position == src->read_position))
     src->request_position = new_position;