diff options
author | Chong Zhang <chz@google.com> | 2014-07-11 15:53:58 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2014-07-11 19:42:55 -0700 |
commit | 94686d13cacbec1ce7cf5fd0178fffb037d03cc1 (patch) | |
tree | 35968401f72f83db5cb08c0c1a4386b3ece1c76a /media/jni | |
parent | d336042f7a6d72a37195b5f1a90632e975b22d71 (diff) | |
download | frameworks_base-94686d13cacbec1ce7cf5fd0178fffb037d03cc1.zip frameworks_base-94686d13cacbec1ce7cf5fd0178fffb037d03cc1.tar.gz frameworks_base-94686d13cacbec1ce7cf5fd0178fffb037d03cc1.tar.bz2 |
MediaCodec: change onError cb to send CodecException
Bug: 11990118
Change-Id: I8b6112f126c2f473f64e2aad6ffcfbc3f1d6e64a
Diffstat (limited to 'media/jni')
-rw-r--r-- | media/jni/android_media_MediaCodec.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp index efdacfb..6a835d6 100644 --- a/media/jni/android_media_MediaCodec.cpp +++ b/media/jni/android_media_MediaCodec.cpp @@ -566,20 +566,27 @@ void JMediaCodec::handleCallback(const sp<AMessage> &msg) { case MediaCodec::CB_ERROR: { - CHECK(msg->findInt32("err", &arg2)); - - int32_t actionCode; + int32_t err, actionCode; + CHECK(msg->findInt32("err", &err)); CHECK(msg->findInt32("actionCode", &actionCode)); // use Integer object to pass the action code ScopedLocalRef<jclass> clazz( - env, env->FindClass("java/lang/Integer")); - jmethodID ctor = env->GetMethodID(clazz.get(), "<init>", "(I)V"); - obj = env->NewObject(clazz.get(), ctor, actionCode); + env, env->FindClass("android/media/MediaCodec$CodecException")); + jmethodID ctor = env->GetMethodID(clazz.get(), "<init>", "(IILjava/lang/String;)V"); + + AString str; + const char *detail = "Unknown error"; + if (msg->findString("detail", &str)) { + detail = str.c_str(); + } + jstring msgObj = env->NewStringUTF(detail); + + obj = env->NewObject(clazz.get(), ctor, err, actionCode, msgObj); if (obj == NULL) { if (env->ExceptionCheck()) { - ALOGE("Could not create Integer object for actionCode."); + ALOGE("Could not create CodecException object."); env->ExceptionClear(); } jniThrowException(env, "java/lang/IllegalStateException", NULL); |