错误0xfffffc03:MediaCodec OMX.sprd.h264.encoder上的android.media.MediaCodec.error_neg_1021

时间:2019-06-13 11:51:02

标签: android mediacodec android-mediacodec

当调用mediacodec API的“配置”方法时,我有此异常:

android.media.MediaCodec$CodecException: Error 0xfffffc03
      at android.media.MediaCodec.native_configure(Native Method)
      at android.media.MediaCodec.configure(MediaCodec.java:577)
      at com.joiedurythme.utils.video.decoder.CutVideoTask.configureEncoder(CutVideoTask.java:231)
      at com.joiedurythme.utils.video.decoder.CutVideoTask.getEncoder(CutVideoTask.java:183)
      at com.joiedurythme.utils.video.decoder.CutVideoTask.prepare(CutVideoTask.java:149)
      at com.joiedurythme.utils.video.decoder.CutVideoTask.run(CutVideoTask.java:95)
      at com.joiedurythme.utils.video.decoder.CodecService.cutVideo(CodecService.java:71)
      at com.joiedurythme.views.player.controller.MediaPlayerController.createMediaFragments(MediaPlayerController.java:562)
      at com.joiedurythme.views.player.controller.MediaPlayerController.createNewFragments(MediaPlayerController.java:726)
      at com.joiedurythme.views.player.controller.MediaPlayerController.cutFragment(MediaPlayerController.java:394)
      at com.joiedurythme.views.player.ActionAreaIndexPlayer$1.onMenuItemClick(ActionAreaIndexPlayer.java:92)
      at android.widget.PopupMenu.onMenuItemSelected(PopupMenu.java:228)
      at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:801)
      at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:155)
      at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:954)
      at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:944)
      at com.android.internal.view.menu.MenuPopupHelper.onItemClick(MenuPopupHelper.java:411)
      at android.widget.AdapterView.performItemClick(AdapterView.java:340)
      at android.widget.AbsListView.performItemClick(AbsListView.java:1532)
      at android.widget.AbsListView$PerformClick.run(AbsListView.java:3700)
      at android.widget.AbsListView$3.run(AbsListView.java:5684)
      at android.os.Handler.handleCallback(Handler.java:739)
      at android.os.Handler.dispatchMessage(Handler.java:95)
      at android.os.Looper.loop(Looper.java:145)
      at android.app.ActivityThread.main(ActivityThread.java:6934)
      at java.lang.reflect.Method.invoke(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:372)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)

此异常是具有以下信息的CodecException:

I/buffers:  Erreur android.media.MediaCodec$CodecException: Error 0xfffffc03
I/CodecException:  e DiagnosticInfo android.media.MediaCodec.error_neg_1021
I/CodecException:  e Recoverable false
I/CodecException:  e Transient   false

我不知道android.media.MediaCodec.error_neg_1021是什么意思。

调用configure方法的代码是:

public MediaCodec configureEncoder(MediaFormat inputMediaFormat) throws IOException {
    final MediaCodec mediaCodecEncoder = MediaCodec.createEncoderByType(MIMETYPE_VIDEO_AVC);

    Log.i("buffers" , " encoder "+mediaCodecEncoder.getName());
    //final MediaCodec mediaCodecEncoder = MediaCodec.createByCodecName("OMX.qcom.video.encoder.avc");
    MediaFormat mediaFormatMp4a = getMediaFormat(inputMediaFormat);
    Log.i("buffers","encode : "+mediaCodecEncoder.getName() );
    Log.i("buffers","dstBuffer : "+mediaFormatMp4a.toString() );
    mediaCodecEncoder.reset();
    mediaCodecEncoder.configure(mediaFormatMp4a, null, null, CONFIGURE_FLAG_ENCODE);
    return mediaCodecEncoder;
}

mediaFormatMp4a信息如下

mediaFormatMp4a {height = 1280,width = 720,bitrate = 600000,mime = video / avc,frame-rate = 30,i-frame-interval = 1,color-format = 19}

编解码器名称为OMX.sprd.h264.encoder。

android leve API是22,我的手机是Samsung Galaxy J3(2016)

0 个答案:

没有答案