OMX.qcom编码器随机崩溃

时间:2016-11-21 14:25:27

标签: android mediacodec video-encoding grafika

该应用程序基于Grafika的相机捕捉活动(https://github.com/google/grafika/tree/master/src/com/android/grafika)。用户点击按钮以录制视频。 Nexus 5x发生随机崩溃。下面发布的是它工作时和不工作时的2个日志。请告诉我这次崩溃的原因可能是什么,如果您需要我发布代码的任何部分。

工作:

11-21 15:55:22.301 26556-27085/com.testvideo I/OMXClient: MuxOMX ctor
11-21 15:55:22.505 26556-27085/com.testvideo E/ACodec: [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -1010
11-21 15:55:22.505 26556-27085/com.testvideo W/ACodec: do not know color format 0x7fa30c04 = 2141391876
11-21 15:55:22.506 26556-27085/com.testvideo W/ACodec: do not know color format 0x7f000789 = 2130708361
11-21 15:55:22.518 26556-27085/com.testvideo I/ACodec: setupAVCEncoderParameters with [profile: Baseline] [level: Level31]
11-21 15:55:22.520 26556-27085/com.testvideo I/ACodec: [OMX.qcom.video.encoder.avc] cannot encode color aspects. Ignoring.
11-21 15:55:22.520 26556-27085/com.testvideo I/ACodec: [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
11-21 15:55:22.520 26556-27085/com.testvideo I/ACodec: setupVideoEncoder succeeded
11-21 15:55:22.523 26556-27085/com.testvideo W/ACodec: do not know color format 0x7f000789 = 2130708361
11-21 15:55:22.586 26556-27082/com.testvideo D/Grafika: EGLContext created, client version 3
11-21 15:55:22.632 26556-27085/com.testvideo D/ACodec: dataspace changed to 0x10c10000 (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) (R:2(Limited), S:1(BT709), T:3(SMPTE_170M))
11-21 15:55:22.698 26556-27082/com.testvideo I/MPEG4Writer: limits: 4294967295/0 bytes/us, bit rate: -1 bps and the estimated moov size 3193 bytes
11-21 15:55:22.721 26556-27098/com.testvideo I/MPEG4Writer: setStartTimestampUs: 0
11-21 15:55:22.721 26556-27098/com.testvideo I/MPEG4Writer: Earliest track starting time: 0
11-21 15:55:31.394 26556-26667/com.testvideo W/OpenGLRenderer: Incorrectly called buildLayer on View: LinearLayout, destroying layer...

发生崩溃时:

11-21 15:28:09.401 526-3443/? I/MediaPlayerService: MediaPlayerService::getOMX
11-21 15:28:09.405 26648-9812/com.testvideo I/OMXClient: MuxOMX ctor
11-21 15:28:09.408 519-15317/? I/OMXMaster: makeComponentInstance(OMX.qcom.video.encoder.avc) in mediacodec process
11-21 15:28:09.432 26648-9374/com.testvideo W/TestVideo.CSR: Waiting for movie encoder to finish before drawing frame
11-21 15:28:09.583 519-15317/? E/OMX-VENC: Setting session priority failed
11-21 15:28:09.586 537-9463/? E/mm-camera-sensor: port_sensor_handle_aec_update:443miss aec update window, skip
11-21 15:28:09.640 519-15317/? I/OMX-VENC: Component_init : OMX.qcom.video.encoder.avc : return = 0x0
11-21 15:28:09.644 519-8957/? E/OMX-VENC: set_parameter: metamode is valid for input port only
11-21 15:28:09.644 519-8957/? W/OMXNodeInstance: [207006a:qcom.encoder.avc] component does not support metadata mode; using fallback
11-21 15:28:09.644 26648-9812/com.testvideo E/ACodec: [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -1010
11-21 15:28:09.645 26648-9812/com.testvideo W/ACodec: do not know color format 0x7fa30c04 = 2141391876
11-21 15:28:09.645 26648-9812/com.testvideo W/ACodec: do not know color format 0x7f000789 = 2130708361
11-21 15:28:09.654 26648-9812/com.testvideo I/ACodec: setupAVCEncoderParameters with [profile: Baseline] [level: Level31]
11-21 15:28:09.655 26648-9812/com.testvideo I/ACodec: [OMX.qcom.video.encoder.avc] cannot encode color aspects. Ignoring.
11-21 15:28:09.655 26648-9812/com.testvideo I/ACodec: [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
11-21 15:28:09.655 26648-9812/com.testvideo I/ACodec: setupVideoEncoder succeeded
11-21 15:28:09.658 26648-9812/com.testvideo W/ACodec: do not know color format 0x7f000789 = 2130708361
11-21 15:28:09.668 519-15317/? D/GraphicBufferSource: setting dataspace: 0x104
11-21 15:28:09.669 519-3849/? E/OMXNodeInstance: getParameter(207006a:qcom.encoder.avc, ParamConsumerUsageBits(0x6f800004)) ERROR: UnsupportedIndex(0x8000101a)
11-21 15:28:09.669 519-3674/? D/GraphicBufferSource: requesting color aspects (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M))

1 个答案:

答案 0 :(得分:1)

我遇到过类似的问题,不确定它是否相同。

当它正常工作时,它应该会显示日志信息。

D/ACodec: dataspace changed to 0x10c10000 (R:2(Limited), P:1(BT709_5), M:1(BT709_5), T:3(SMPTE170M)) (R:2(Limited), S:1(BT709), T:3(SMPTE_170M))

因此编码器可以在初始化阶段接收缓冲区的状态。

encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED

在我的程序中,OnframeAvailable函数和渲染线程已同时被锁定,并且在记录初始化开始时不再能够相互通知。由于OnframeAvailable函数已被卡住,因此无法更新缓冲区。结果,MeidaCodec永远不会获得INFO_OUTPUT_FORMAT_CHANGED状态。

检查录制开始时frameAvailable()或frameAvailableSoon()是否保持更新。