是否可以在Android Java层中对mallococ内存进行malloc?

时间:2022-10-23 03:56:34

I set the "csd-0" and "csd-1" into MediaCodec by MediaFormat as following:

我通过MediaFormat将“csd-0”和“csd-1”设置为MediaCodec,如下所示:

byte[] sps = { 0, 0, 0, 1, 103, 100, 0, 40, -84, 52, -59, 1, -32, 17, 31, 120, 11, 80, 16, 16, 31, 0, 0, 3, 3, -23, 0, 0, -22, 96, -108 };
byte[] pps = { 0, 0, 0, 1, 104, -18, 60, -128 };
MediaFormat format = MediaFormat.createVideoFormat("video/avc", width, height);
format.setByteBuffer("csd-0", ByteBuffer.wrap(sps));
format.setByteBuffer("csd-1", ByteBuffer.wrap(pps));
...

But i got the error like this:

但是我得到了这样的错误:

E/MtkOmxVenc( 6724): Error: BufferType is not Gralloc Source !!!!
F/libc    ( 6724): Fatal signal 11 (SIGSEGV) at 0x28006467 (code=1), thread 7500 (MtkOmxVencEncod)

So i want to try to set the Gralloc source to fix it. Any suggestions ?

所以我想尝试设置Gralloc源来修复它。有什么建议 ?

1 个解决方案

#1


0  

gralloc is the memory allocator used to allocate graphics buffers. It's provided by a kernel driver. You pass in width, height, and color format, and it hands back a reference to a buffer with the necessary attributes, taking into account any platform-specific padding and alignment restrictions.

gralloc是用于分配图形缓冲区的内存分配器。它由内核驱动程序提供。您传递宽度,高度和颜色格式,并将具有必要属性的缓冲区的参考传回,同时考虑任何特定于平台的填充和对齐限制。

The codec-specific data values should not be held in a gralloc buffer. The CTS EncodeDecodeTest does exercise setByteBuffer(), so I'd be surprised if it's entirely broken.

特定于编解码器的数据值不应保存在gralloc缓冲区中。 CTS EncodeDecodeTest确实运行了setByteBuffer(),所以如果完全破坏我会感到惊讶。

My guess would be that MtkOmxVenc has a bug.

我的猜测是MtkOmxVenc有一个bug。

#1


0  

gralloc is the memory allocator used to allocate graphics buffers. It's provided by a kernel driver. You pass in width, height, and color format, and it hands back a reference to a buffer with the necessary attributes, taking into account any platform-specific padding and alignment restrictions.

gralloc是用于分配图形缓冲区的内存分配器。它由内核驱动程序提供。您传递宽度,高度和颜色格式,并将具有必要属性的缓冲区的参考传回,同时考虑任何特定于平台的填充和对齐限制。

The codec-specific data values should not be held in a gralloc buffer. The CTS EncodeDecodeTest does exercise setByteBuffer(), so I'd be surprised if it's entirely broken.

特定于编解码器的数据值不应保存在gralloc缓冲区中。 CTS EncodeDecodeTest确实运行了setByteBuffer(),所以如果完全破坏我会感到惊讶。

My guess would be that MtkOmxVenc has a bug.

我的猜测是MtkOmxVenc有一个bug。