Android MediaCodec中的错误代码-1010是什么意思? [英] What does error code -1010 in Android MediaCodec mean?

查看:1908
本文介绍了Android MediaCodec中的错误代码-1010是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是堆栈跟踪:

 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上.

Crash is on Nexus 6P.

mediaCodec的初始化:

Initialization of 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);

推荐答案

我在尝试将16:9的视频编码为.h264并更改帧大小时遇到​​了这个问题(在4:3时效果很好).

I had this issue while i was trying to encode 16:9 videos to .h264 and change the frame size (it worked fine with 4:3).

对我来说,解决方法是确保输出格式的高度和宽度能被2整除.如果不是,则将它们四舍五入,以使它们对齐.

The fix for me was to ensure that the height and width of the output format were divisible by 2. If they weren't, I just rounded them up so they did.

这篇关于Android MediaCodec中的错误代码-1010是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆