glupload: move meta-data copy into gst-gl library
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 14 Mar 2015 18:48:21 +0000 (19:48 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Sat, 9 Dec 2017 19:31:58 +0000 (19:31 +0000)
In some upload implementations the out buffer has more than one references,
turning the buffer not writable, so it won't be possible to modify its
meta-data.

This patch moves the meta-data copy before increasing the reference of the out
buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=746173

ext/gl/gstgluploadelement.c
gst-libs/gst/gl/gstglupload.c

index 056c1be..a8971d8 100644 (file)
@@ -239,9 +239,6 @@ gst_gl_upload_element_prepare_output_buffer (GstBaseTransform * bt,
   /* basetransform doesn't unref if they're the same */
   if (buffer == *outbuf)
     gst_buffer_unref (*outbuf);
-  else if (*outbuf)
-    gst_buffer_copy_into (*outbuf, buffer,
-        GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
 
   return ret == GST_GL_UPLOAD_DONE ? GST_FLOW_OK : GST_FLOW_ERROR;
 }
index d675f12..635477f 100644 (file)
@@ -1109,8 +1109,12 @@ restart:
     NEXT_METHOD;
   }
 
-  if (outbuf_ptr)
+  if (outbuf_ptr) {
+    if (buffer != upload->priv->outbuf)
+      gst_buffer_copy_into (upload->priv->outbuf, buffer,
+          GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
     *outbuf_ptr = gst_buffer_ref (upload->priv->outbuf);
+  }
 
   GST_OBJECT_UNLOCK (upload);