2

When I try to decode H.264 raw stream with MediaCodec on Note3(N9005, Android 4.3) , I get these errors:

12-25 19:57:40.362: E/ACodec(19827): [OMX.qcom.video.decoder.avc] ERROR(0x80001009)
12-25 19:57:40.362: E/MediaCodec(19827): Codec reported an error. (omx error 0x80001009, internalError -2147483648)
12-25 19:57:40.362: W/System.err(19827): java.lang.IllegalStateException
12-25 19:57:40.362: W/System.err(19827): at android.media.MediaCodec.dequeueInputBuffer(Native Method)

But the same codes work on Note3(N900) and Google Nexus 7 (the 2nd Generation). Here is the code what I referenced to: http://developer.android.com/reference/android/media/MediaCodec.html P.S: the header of my H.264 raw stream looks like this:

---------------------------------------------------------------------------------------
|00 00 00 01 67 ... 00 00 00 01 68 ...00 00 00 01 65(tatol 4 slices )...00 00 00 01 61|
---------------------------------------------------------------------------------------

I can attach my testing video file for you if need.

fadden
  • 51,356
  • 5
  • 116
  • 166
hopetribe
  • 91
  • 1
  • 4
  • What's the source of the encoded video? Was it created with MediaCodec? FWIW, various examples can be found on http://bigflake.com/mediacodec/ (including some CTS tests that operate on H.264 streams). – fadden Dec 26 '13 at 05:14
  • The video was created by other encoder. the Mediacodec part is OK, work on Samsung galaxy Note3(N900), Samsung Note5110 and Nexus 7 except N9005 – hopetribe Dec 26 '13 at 07:05
  • The problem was finally solved。 I chanded the codec.queueInputBuffer(inIndex, 0, size, 0, MediaCodec.BUFFER_FLAG_CODEC_CONFIG) to codec.queueInputBuffer(inIndex, 0, size, 0, 0), the crash's gone, Solved! But I still don't understand why? Can anybody explain it? Thanks. – hopetribe Dec 27 '13 at 07:22
  • You didn't include any of your code in the question, so it's hard to say. I can say that the `CODEC_CONFIG` flag should only be specified for the buffer that has the CSD (SPS/PPS) data, and that if you include the CSD as part of the `MediaFormat` then you should just drop that buffer entirely. The behavior of `MediaCodec` codecs is poorly specified; while there is a CTS test that exercises both good paths (CSD in format, CSD in buffer), there's none that mandates specific behavior for the bad paths (CSD twice, no CSD), so behavior in those cases is undefined. – fadden Dec 27 '13 at 16:50

1 Answers1

0

The MediaCodec invoke OpenMax(OMX) to decode Video Stream. It depends on specific system framework so not works very well on any device. You can test this Sample in Github And Android Hardware Decoding with MediaCodec maybe help