summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2013-02-15 13:08:18 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2013-02-15 13:08:18 +0100
commit95fcc27fc94af0c5e76cc43923d4c871339324fa (patch)
treedbcc864988eec6afababee171115441ab171575d
parent6e74c769751c1169466ea381cf9bbb30d741dee2 (diff)
allocator: improve fallback copy functionrelease-pool
Only use the allocator of the copied memory when we can use the default _alloc function on it. Otherwise we will have to use the default allocator for the copy.
-rw-r--r--gst/gstallocator.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gst/gstallocator.c b/gst/gstallocator.c
index b2f6a31a4..3a37af619 100644
--- a/gst/gstallocator.c
+++ b/gst/gstallocator.c
@@ -95,6 +95,7 @@ _fallback_mem_copy (GstMemory * mem, gssize offset, gssize size)
GstMemory *copy;
GstMapInfo sinfo, dinfo;
GstAllocationParams params = { 0, mem->align, 0, 0, };
+ GstAllocator *allocator;
if (!gst_memory_map (mem, &sinfo, GST_MAP_READ))
return NULL;
@@ -103,7 +104,11 @@ _fallback_mem_copy (GstMemory * mem, gssize offset, gssize size)
size = sinfo.size > offset ? sinfo.size - offset : 0;
/* use the same allocator as the memory we copy */
- copy = gst_allocator_alloc (mem->allocator, size, &params);
+ allocator = mem->allocator;
+ if (GST_OBJECT_FLAG_IS_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC))
+ allocator = NULL;
+ copy = gst_allocator_alloc (allocator, size, &params);
+
if (!gst_memory_map (copy, &dinfo, GST_MAP_WRITE)) {
GST_CAT_WARNING (GST_CAT_MEMORY, "could not write map memory %p", copy);
gst_allocator_free (mem->allocator, copy);