mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
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
This commit is contained in:
parent
6617d6f577
commit
03c54e7c0f
1 changed files with 14 additions and 2 deletions
|
@ -131,6 +131,7 @@ gst_omx_memory_allocator_alloc (GstAllocator * allocator, GstMemoryFlags flags,
|
||||||
GstOMXBuffer * buf)
|
GstOMXBuffer * buf)
|
||||||
{
|
{
|
||||||
GstOMXMemory *mem;
|
GstOMXMemory *mem;
|
||||||
|
gint align;
|
||||||
|
|
||||||
/* FIXME: We don't allow sharing because we need to know
|
/* FIXME: We don't allow sharing because we need to know
|
||||||
* when the memory becomes unused and can only then put
|
* 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;
|
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);
|
mem = g_slice_new (GstOMXMemory);
|
||||||
/* the shared memory is always readonly */
|
/* the shared memory is always readonly */
|
||||||
gst_memory_init (GST_MEMORY_CAST (mem), flags, allocator, NULL,
|
gst_memory_init (GST_MEMORY_CAST (mem), flags, allocator, NULL,
|
||||||
buf->omx_buf->nAllocLen, buf->port->port_def.nBufferAlignment,
|
buf->omx_buf->nAllocLen, align, 0, buf->omx_buf->nAllocLen);
|
||||||
0, buf->omx_buf->nAllocLen);
|
|
||||||
|
|
||||||
mem->buf = buf;
|
mem->buf = buf;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue