summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-07-01 10:36:36 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-07-01 10:37:37 +0200
commit0aae36567d2e2c9109823c783d7e920cebef6a3f (patch)
treeaa8229c688017ef51a42f22fa618bd07b4799aae /gst
parentd43f256a9e1acc69c85bf3898e142cdf8bce7def (diff)
buffer: Don't copy "memory" metas unconditionally
Don't copy memory metas if we only copied part of the buffer, didn't copy memories or merged memories. In all these cases the memory structure has changed and the memory meta becomes meaningless. https://bugzilla.gnome.org/show_bug.cgi?id=751712
Diffstat (limited to 'gst')
-rw-r--r--gst/gstbuffer.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c
index f86df33ab5..56b190a4bb 100644
--- a/gst/gstbuffer.c
+++ b/gst/gstbuffer.c
@@ -534,7 +534,17 @@ gst_buffer_copy_into (GstBuffer * dest, GstBuffer * src,
GstMeta *meta = &walk->meta;
const GstMetaInfo *info = meta->info;
- if (info->transform_func) {
+ /* Don't copy memory metas if we only copied part of the buffer, didn't
+ * copy memories or merged memories. In all these cases the memory
+ * structure has changed and the memory meta becomes meaningless.
+ */
+ if ((region || !(flags & GST_BUFFER_COPY_MEMORY)
+ || (flags & GST_BUFFER_COPY_MERGE))
+ && gst_meta_api_type_has_tag (info->api, _gst_meta_tag_memory)) {
+ GST_CAT_DEBUG (GST_CAT_BUFFER,
+ "don't copy memory meta %p of API type %s", meta,
+ g_type_name (info->api));
+ } else if (info->transform_func) {
GstMetaTransformCopy copy_data;
copy_data.region = region;