Skip to content

Crash in libmedia_jni.so when using MediaCodec callback with DJI SDK #1338

@huongta157

Description

@huongta157

We’re encountering a native crash while using DJI Mobile SDK together with Android’s MediaCodec API for video decoding. The crash occurs inside libmedia_jni.so during the callback handling.

Backtrace:

#06 pc ... /system/lib64/libmedia_jni.so (android::JMediaCodec::handleCallback(android::sp<android::AMessage> const&)+524)
#04 pc ... /apex/com.android.art/lib64/libart.so (art::JNI<false>::FindClass+696)
#00 pc ... /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
...

It looks like a FindClass call from native code is failing during a MediaCodec callback, which causes an abort in ART runtime.

Steps:

  • We are using MediaCodec.setCallback(...) with a custom HandlerThread.
  • The crash occurs intermittently during video playback/streaming via DJI SDK.

Questions:
1. Is DJI SDK internally using MediaCodec or handling JMediaCodec callbacks that may conflict with app-level MediaCodec usage?
2. Are there known limitations or conflicts when using MediaCodec callbacks in background threads?
3. What’s the recommended way to safely integrate custom MediaCodec usage alongside DJI’s video pipeline?

We appreciate any suggestions or guidance to prevent this crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions