简体   繁体   English

在Android 4.2上调整Mediacodec解码器的缓冲区大小

[英]Adjust the buffer size of Mediacodec's decoder on Android 4.2

I'm decoding a H.264 stream on Android 4.2 using Mediacodec. 我正在使用Mediacodec在Android 4.2上解码H.264流。 Unfortunately, the decoder always buffers 6-10 frames, which lead to annoying latency, and Android does not provide any API to adjust buffer size. 不幸的是,解码器总是缓存6-10帧,这会导致烦人的延迟,而Android不提供任何API来调整缓冲区大小。 So my question is, how to modify the Android source code (or the OMX driver) in order to reduce the buffer size for realtime video streaming? 所以我的问题是,如何修改Android源代码(或OMX驱动程序)以减少实时视频流的缓冲区大小?

Generally speaking, you don't. 一般来说,您不需要。 The number of buffers in the queue is determined by the codec. 队列中的缓冲区数由编解码器确定。 Different devices, and different codecs on the same device, can behave differently. 不同的设备以及同一设备上的不同编解码器的行为可能有所不同。

Unless you're using the software AVC codec, the codec implementation is provided as a binary by the hardware OEM, so there's no way to modify it (short of hex-editing). 除非您使用软件AVC编解码器,否则硬件OEM会以二进制形式提供编解码器实现,因此无法修改它(缺少十六进制编辑)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM