0

I am building an android video player app with the new API MediaCodec and MediaExtractor (available from API 16). It normally works well but sometimes I have a crash with a very meaningless messages:

09-30 16:39:13.985: A/MediaCodec(6508): frameworks/av/media/libstagefright/MediaCodec.cpp:423 CHECK(buffer->meta()->findInt64("timeUs", &timeUs)) failed.
09-30 16:39:13.985: A/libc(6508): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 12769 (MediaCodec_loop)

If would be good if somebody could give me a better understanding of what was going wrong. The crash normally happens when I open the video, play a little bit, quit it, going to another video. It only happens very few amount of time but very annoying.

vodkhang
  • 18,639
  • 11
  • 76
  • 110
  • 1
    That's a failing assert inside the mediacodec code. It's expecting to find a timestamp and failing. (The libstagefright implementation communicates internally with name/value pair messages.) What version of Android are you using? The line number is off slightly, but JB-MR1/JB-MR1.1 is close: https://android.googlesource.com/platform/frameworks/av/+/jb-mr1.1-release/media/libstagefright/MediaCodec.cpp (see line 421). – fadden Sep 30 '13 at 14:43

1 Answers1

1

I finally find out the solution. I answer here so people who found the same problem can fix it.

When my mediacodec plays near the end of file, it doesn't queue more input buffer into the inputQueue, therefore when it needs to dequeue the buffers, it cannot find any buffer to play

vodkhang
  • 18,639
  • 11
  • 76
  • 110