vtdec: handle non-consecutive GstBuffer input without copying
authorIlya Konstantinov <ilya.konstantinov@gmail.com>
Sun, 28 Jun 2015 23:42:06 +0000 (02:42 +0300)
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>
Mon, 13 Jul 2015 15:11:04 +0000 (11:11 -0400)
commitbfa054a7337721032dd252c29fbbfc980a0b45a2
treeb2f17b978a52808ab7ea6272a18cf6599cf78ba8
parentc1906f1cfe1567b75c9a4d6a83e518dd1754402b
vtdec: handle non-consecutive GstBuffer input without copying

CMBlockBuffer offers a model similar to GstBuffer, as it can
consist of multiple non-consecutive memory blocks.

Prior to this change, what we were doing was:

 1) Incorrect:

   CMBlockBufferCreateWithMemoryBlock does not copy the data,
   but we gst_buffer_unmap'd right away.

 2) Inefficient:

   If the GstBuffer consisted of non-contiguous memory blocks,
   gst_buffer_map resulted in malloc / memcpy.

With this change, we construct a CMBlockBuffer out of individual mapped
GstMemory objects. CMBlockBuffer is made to retain the GstMemory
objects (through the use of CMBlockBufferCustomBlockSource), so the
original GstBuffer can be unref'd.

https://bugzilla.gnome.org/show_bug.cgi?id=751241
sys/applemedia/vtdec.c