summaryrefslogtreecommitdiff
path: root/omx/gstomxbufferpool.c
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-06-24 12:42:22 +0200
committerSebastian Dröge <sebastian@centricular.com>2014-06-24 12:42:22 +0200
commit03c54e7c0fbba61a5b2bf2610b62902321a087da (patch)
tree93551686d793b5ef1482be582c27d051baee0204 /omx/gstomxbufferpool.c
parent6617d6f577e72cabbc299f68b6e92baefd6b7397 (diff)
downloadgst-omx-03c54e7c0fbba61a5b2bf2610b62902321a087da.tar.gz
omxbufferpool: Properly convert OMX alignment to GStreamer alignment
GStreamer uses a bitmask for the alignment while OMX uses the alignment itself. Let's convert. https://bugzilla.gnome.org/show_bug.cgi?id=710564
Diffstat (limited to 'omx/gstomxbufferpool.c')
-rw-r--r--omx/gstomxbufferpool.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/omx/gstomxbufferpool.c b/omx/gstomxbufferpool.c
index 43fc656..decd94d 100644
--- a/omx/gstomxbufferpool.c
+++ b/omx/gstomxbufferpool.c
@@ -131,6 +131,7 @@ gst_omx_memory_allocator_alloc (GstAllocator * allocator, GstMemoryFlags flags,
GstOMXBuffer * buf)
{
GstOMXMemory *mem;
+ gint align;
/* FIXME: We don't allow sharing because we need to know
* when the memory becomes unused and can only then put
@@ -139,11 +140,22 @@ gst_omx_memory_allocator_alloc (GstAllocator * allocator, GstMemoryFlags flags,
*/
flags |= GST_MEMORY_FLAG_NO_SHARE;
+ /* GStreamer uses a bitmask for the alignment while
+ * OMX uses the alignment itself. So we have to convert
+ * here */
+ align = buf->port->port_def.nBufferAlignment;
+ if (align > 0)
+ align -= 1;
+ if (((align + 1) & align) != 0) {
+ GST_WARNING ("Invalid alignment that is not a power of two: %u",
+ buf->port->port_def.nBufferAlignment);
+ align = 0;
+ }
+
mem = g_slice_new (GstOMXMemory);
/* the shared memory is always readonly */
gst_memory_init (GST_MEMORY_CAST (mem), flags, allocator, NULL,
- buf->omx_buf->nAllocLen, buf->port->port_def.nBufferAlignment,
- 0, buf->omx_buf->nAllocLen);
+ buf->omx_buf->nAllocLen, align, 0, buf->omx_buf->nAllocLen);
mem->buf = buf;