Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OMX.qcom encoder random crash

The app is based on Grafika's camera capture activity (https://github.com/google/grafika/tree/master/src/com/android/grafika). The user taps on a button to record a video. A random crash is happening on Nexus 5x. Posted below are 2 logs of when it is working and when it is not. Please tell me what might be the cause of this crash and if you need me to post any part of the code.

Working:

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

When Crash occurs:

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))
like image 578
Ziad Halabi Avatar asked Nov 21 '16 14:11

Ziad Halabi


1 Answers

I have been encountered a similar question, not sure if it is the same.

When it is working, it should come out with the fallowing log information.

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))

So the encoder could receive the status of buffer at initialization phase.

encoderStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED

In my program, the OnframeAvailable function and the render thread have been locked at the same time and no longer been able to notify each other at the start of recording initialization. Since the OnframeAvailable function has been stuck, the buffer could not be updated. As the result, the MeidaCodec never get the INFO_OUTPUT_FORMAT_CHANGED status.

Check if the frameAvailable() or frameAvailableSoon() is keeping update when recording start.

like image 77
yu en Huang Avatar answered Nov 07 '22 07:11

yu en Huang