Android MediaCodec 中的错误代码 -1010 是什么意思?

What does error code -1010 in Android MediaCodec mean?

这是堆栈跟踪:

 E/ACodec: [OMX.qcom.video.encoder.avc] configureCodec returning error -1010
 E/ACodec: signalError(omxError 0x80001001, internalError -1010)
 E/MediaCodec: Codec reported err 0xfffffc0e, actionCode 0, while in state 3
 E/MediaCodec: configure failed with err 0xfffffc0e, resetting...
W/System.err: android.media.MediaCodec$CodecException: Error 0xfffffc0e
W/System.err:     at android.media.MediaCodec.native_configure(Native Method)
W/System.err:     at android.media.MediaCodec.configure(MediaCodec.java:1778)

Nexus 6P 崩溃。

mediaCodec 初始化:

videoCodec = MediaCodec.createEncoderByType(MIME_VIDEO_CODEC_H264);

        MediaFormat videoFormat = MediaFormat.createVideoFormat(MIME_VIDEO_CODEC_H264, imageWidth, imageHeight);
        videoFormat.setInteger(MediaFormat.KEY_BIT_RATE, camera.getBitrate());
        videoFormat.setInteger(MediaFormat.KEY_FRAME_RATE, camera.getFrameRate());
        videoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
        videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 0);
        videoCodec.configure(videoFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);

这似乎是 Qualcomm 编解码器实施报告的内部错误 (OMX.qcom.video.encoder.avc)。

可能是, it might indicate a configuration problem, or a different configuration problem, or some other configuration problem。大多数情况下,它似乎只是表明它不喜欢您的配置,而没有提供任何具体原因的见解。

错误代码有点无用,因此您必须从已知有效的值开始,一次更改一个值,直到出现问题。您为 bit/frame 比率传递的实际值是多少?

我在尝试将 16:9 视频编码为 .h264 并更改帧大小时遇到​​了这个问题(它在 4:3 上运行良好)。

我的解决方法是确保输出格式的高度和宽度可以被 2 整除。如果不能,我就将它们四舍五入。