我捕获了android.media.MediaCodec$CodecException: Error 0x80001001,有时当我试图以下一种方式配置MediaCodec时:
MediaFormat outputFormat = new MediaFormat();
outputFormat.setString(MediaFormat.KEY_MIME, COMPRESSED_AUDIO_FILE_MIME_TYPE);
outputFormat.setInteger(MediaFormat.KEY_CHANNEL_COUNT, 2);
outputFormat.setInteger(MediaFormat.KEY_SAMPLE_RATE, frequency);
outputFormat.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC);
outputFormat.setInteger(MediaFormat.KEY_BIT_RATE, COMPRESSED_AUDIO_FILE_BIT_RATE);
outputFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, 0);
MediaCodec codec = MediaCodec.createEncoderByType(COMPRESSED_AUDIO_FILE_MIME_TYPE);
codec.configure(outputFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
codec.start();
完整的坠机日志:
E/OMXMaster﹕ A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
E/ACodec﹕ [OMX.google.aac.encoder] configureCodec returning error -38
E/ACodec﹕ signalError(omxError 0x80001001, internalError -2147483648)
E/MediaCodec﹕ Codec reported err 0x80001001, actionCode 0, while in state 3
E/MediaCodec﹕ configure failed with err 0x80001001, resetting...
I/OMXClient﹕ Using client-side OMX mux.
E/OMXMaster﹕ A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one.
因此,正如我所理解的,这个问题出现在本机代码中。但是它只出现在一些设备上--比如在Nexus 7和Android5.1上,而Nexus 10在相同的Android版本上工作得很好。
我似乎找到了MediaCodec的来源和崩溃所在的地方。这里是链接http://sourceforge.net/p/opencore-amr/vo-aacenc/ci/2418ead75aa9cdaf01cb4286f38fb7be2d48bd8d/tree/aacenc/SoftAACEncoder2.cpp#l362。
发布于 2015-05-06 13:01:56
实际上,我的音频文件的WAV头出现了问题。我在异步任务中运行了一个转换,但是在它运行后写了一个头。因此,有时我试图在没有头的情况下转换wav文件。因为我从wav头中提取了一些参数(比如频率等),所以我得到了一个0值。因此,无法配置MediaCodec并使其崩溃。
https://stackoverflow.com/questions/30034919
复制相似问题