diff options
Diffstat (limited to 'media/jni/android_media_MediaCodec.cpp')
-rw-r--r-- | media/jni/android_media_MediaCodec.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index 71457b7..5f586a9 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -70,6 +70,11 @@ static struct CodecActionCodes { jint codecActionRecoverable; } gCodecActionCodes; +static struct ExceptionReason { + jint reasonHardware; + jint reasonReclaimed; +} gExceptionReason; + struct fields_t { jfieldID context; jmethodID postEventFromNativeID; @@ -568,7 +573,7 @@ static jthrowable createCodecException( env, env->FindClass("android/media/MediaCodec$CodecException")); CHECK(clazz.get() != NULL); - const jmethodID ctor = env->GetMethodID(clazz.get(), "<init>", "(IILjava/lang/String;)V"); + const jmethodID ctor = env->GetMethodID(clazz.get(), "<init>", "(IILjava/lang/String;I)V"); CHECK(ctor != NULL); ScopedLocalRef<jstring> msgObj( @@ -587,7 +592,9 @@ static jthrowable createCodecException( break; } - return (jthrowable)env->NewObject(clazz.get(), ctor, err, actionCode, msgObj.get()); + // TODO: propagate reason from MediaCodec. + int reason = gExceptionReason.reasonHardware; + return (jthrowable)env->NewObject(clazz.get(), ctor, err, actionCode, msgObj.get(), reason); } void JMediaCodec::handleCallback(const sp<AMessage> &msg) { @@ -669,14 +676,6 @@ void JMediaCodec::handleCallback(const sp<AMessage> &msg) { break; } - case MediaCodec::CB_CODEC_RELEASED: - { - if (!msg->findInt32("reason", &arg2)) { - arg2 = MediaCodec::REASON_UNKNOWN; - } - break; - } - default: TRESPASS(); } @@ -1462,6 +1461,16 @@ static void android_media_MediaCodec_native_init(JNIEnv *env) { CHECK(field != NULL); gCodecActionCodes.codecActionRecoverable = env->GetStaticIntField(clazz.get(), field); + + field = env->GetStaticFieldID(clazz.get(), "REASON_HARDWARE", "I"); + CHECK(field != NULL); + gExceptionReason.reasonHardware = + env->GetStaticIntField(clazz.get(), field); + + field = env->GetStaticFieldID(clazz.get(), "REASON_RECLAIMED", "I"); + CHECK(field != NULL); + gExceptionReason.reasonReclaimed = + env->GetStaticIntField(clazz.get(), field); } static void android_media_MediaCodec_native_setup( |