sysmem: Only copy the requested part of memory instead of the complete source memory

https://bugzilla.gnome.org/show_bug.cgi?id=705678
This commit is contained in:
Sebastian Dröge 2013-08-13 13:06:50 +02:00
parent 104db59706
commit 5d26d67ba7

View file

@ -458,13 +458,10 @@ _sysmem_copy (GstMemorySystem * mem, gssize offset, gsize size)
if (size == -1) if (size == -1)
size = mem->mem.size > offset ? mem->mem.size - offset : 0; size = mem->mem.size > offset ? mem->mem.size - offset : 0;
copy = copy = _sysmem_new_block (0, size, mem->mem.align, 0, size);
_sysmem_new_block (0, mem->mem.maxsize, mem->mem.align,
mem->mem.offset + offset, size);
GST_CAT_DEBUG (GST_CAT_PERFORMANCE, GST_CAT_DEBUG (GST_CAT_PERFORMANCE,
"memcpy %" G_GSIZE_FORMAT " memory %p -> %p", mem->mem.maxsize, mem, "memcpy %" G_GSIZE_FORMAT " memory %p -> %p", size, mem, copy);
copy); memcpy (copy->data, mem->data + mem->mem.offset + offset, size);
memcpy (copy->data, mem->data, mem->mem.maxsize);
return copy; return copy;
} }