9

Using MediaCodec, many times error messages come from OMX layer. How can one use them to help debug not so trivial issues? For example, I have an application which sometimes fails to create a codec for decoding an h264 stream. It seems to happen only on some devices like Samsung S4 (I9505), while not happening on S3, Nexus 4(old). The same video is decoded fine in most cases on S4. Before creating the codec, there is some intensive computation, including OpeGL stuff. The line where it fails is:

MediaCodec.createByCodecName(codecInfo[0].getName());

With codecInfo[0].getName() having the value OMX.qcom.video.decoder.avc and the following output in logcat:

06-23 19:12:18.197: I/OMXClient(23749): Using client-side OMX mux.
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): In OMX vdec Constructor
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): vidc.dec.debug.ts value is 0
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): vidc.dec.debug.concealedmb value is 0
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): vidc.dec.debug.extradata value is 0
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): Successfully opened vdec ion devicefd = 35
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): Successfully created vdec ionlock
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): Vdec instances = 1, ion device fd = 35
06-23 19:12:18.197: E/OMX-VDEC-1080P(282): omx_vdec::component_init(): Start of New Playback : role  = OMX.qcom.video.decoder.avc : DEVICE = /dev/msm_vidc_dec
06-23 19:12:18.197: D/STATUSBAR-NetworkController(1111): updateDataNetType()
06-23 19:12:18.197: D/STATUSBAR-NetworkController(1111): Nothing, mRoamingIconId = 0
06-23 19:12:18.227: E/OMX-VDEC-1080P(282): omx_vdec::component_init(): Open returned fd 36, errno 24
06-23 19:12:18.227: E/OMX-VDEC-1080P(282): component_init: current performance level = 0 
06-23 19:12:18.227: E/OMX-VDEC-1080P(282):  pipe creation failed.
06-23 19:12:18.227: E/OMX-VDEC-1080P(282):  Component Init Failed
06-23 19:12:18.227: E/OMX-VDEC-1080P(282): Calling VDEC_IOCTL_STOP_NEXT_MSG
06-23 19:12:18.227: E/OMX-VDEC-1080P(282): In OMX Vdec Destructor(), Vdec instances = 1
06-23 19:12:18.227: E/OMX-VDEC-1080P(282): Calling close() on Video Driver
06-23 19:12:18.247: E/OMX-VDEC-1080P(282): Calling close() on vdec ion devicefd = 35
06-23 19:12:18.247: E/OMX-VDEC-1080P(282): Successfully destroyed vdec ionlock
06-23 19:12:18.247: E/OMX-VDEC-1080P(282): Exit OMX vdec Destructor
06-23 19:12:18.247: E/(282):  Destroy C2D instance
06-23 19:12:18.247: E/(282):  Destroy C2D instance
06-23 19:12:18.247: E/ACodec(23749): Unable to instantiate decoder 'OMX.qcom.video.decoder.avc'.
06-23 19:12:18.247: E/MediaCodec(23749): Codec reported an error. (omx error 0x80001003, internalError -2147483648)

Also, in case it is a device dependent error, what can a developer do to help solve the issue?

user1592546
  • 1,480
  • 1
  • 14
  • 30
  • 2
    what do you mean by "sometimes fails to create a codec for decoding an h264 stream"? sometimes works, sometimes not? The only reason I met for this is not releasing decoder after using. Some devices allow to have only one instance of codec, so if you have used codec and did not release it before next use it fails to instantiate – Marlon Jun 24 '14 at 14:12
  • Yes, I mean most times it works, but for about 5%, the errors above appear. It happens only on this device. And it happened also for the first video. But thanks for the tip, I'll check if a decoder gets created for other reasons before actually decoding. – user1592546 Jun 25 '14 at 17:32
  • 2
    To easily check if it is double instantiation, what suggest errno 24 - EMFILE, of the Venus check it in dmesg (kernel log). Vdec component sources you may find in hardware/qcom/media/mm-video (or mm-video-msm8974 i you use it). Related drivers code you will identify tracking down IOCTL's enums. – Ryszard Grzesica Jul 09 '14 at 09:55
  • 1
    The error was due to intensive use of: MediaMetadataRetriever object creation, then calling prepare and extractMetadata(METADATA_KEY_DURATION), per frame. So it was double instantiation of the decoder, due to an error on my side. I'm leaving it open, for the case that someone provides good resources/tutorial to handle this kind of errors. – user1592546 Jul 24 '14 at 19:07
  • check this : https://github.com/google/ExoPlayer/issues/1286 – Hamed Ghadirian Oct 04 '16 at 13:08

0 Answers0