buffer: do not touch memory tag flag when copying buffer flags
authorArnaud Vrac <avrac@freebox.fr>
Tue, 26 Aug 2014 18:14:40 +0000 (20:14 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 28 Aug 2014 09:20:12 +0000 (12:20 +0300)
The tag memory flag will be set later if the memory is also copied. This
patch avoids buffers being freed needlessly in bufferpools.

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

gst/gstbuffer.c

index 24efc56..eb7077a 100644 (file)
@@ -397,7 +397,11 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
 
   if (flags & GST_BUFFER_COPY_FLAGS) {
     /* copy flags */
-    GST_MINI_OBJECT_FLAGS (dest) = GST_MINI_OBJECT_FLAGS (src);
+    guint flags_mask = ~GST_BUFFER_FLAG_TAG_MEMORY;
+
+    GST_MINI_OBJECT_FLAGS (dest) =
+        (GST_MINI_OBJECT_FLAGS (src) & flags_mask) |
+        (GST_MINI_OBJECT_FLAGS (dest) & ~flags_mask);
   }
 
   if (flags & GST_BUFFER_COPY_TIMESTAMPS) {