diff options
author | Eric Laurent <elaurent@google.com> | 2010-09-24 12:03:36 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-09-24 13:18:14 -0700 |
commit | 2fb43ef8c0b922c1bd0d7cb6867e30d702d4bdb8 (patch) | |
tree | c1a974c8be8deff650370948aa2a72efa37e198f /media/jni/audioeffect/android_media_AudioEffect.cpp | |
parent | 3ae249dc6a23f40cfc189ce2e25f75de32e7889a (diff) | |
download | frameworks_base-2fb43ef8c0b922c1bd0d7cb6867e30d702d4bdb8.zip frameworks_base-2fb43ef8c0b922c1bd0d7cb6867e30d702d4bdb8.tar.gz frameworks_base-2fb43ef8c0b922c1bd0d7cb6867e30d702d4bdb8.tar.bz2 |
fix problem in AudioEffect JNI setup.
There is a problem in AudioEffect and Visualizer native_setup() methods
that causes a crash in the application after the mediaserver process
has crashed and restarted.
The problem is that the native AudioEffect/Visualizer constructor is
called while the JNI is in critical state after calling
GetPrimitiveArrayCritical(). As the mediaserver process just restarted, the
first call to AudioSystem will cause the binder IAudioflinger interface to
be reteived and a callback send to AudioSystem JNI to clear the mediaserver
error state. This will call env->FindClass() and crash due to the JNI being
in critical state.
Also fixed a similar problem in AudioTrack JNI
Change-Id: I4a9026a3e26c7f78d9b4b4bec1aac90fbee2ab62
Diffstat (limited to 'media/jni/audioeffect/android_media_AudioEffect.cpp')
-rw-r--r-- | media/jni/audioeffect/android_media_AudioEffect.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/media/jni/audioeffect/android_media_AudioEffect.cpp b/media/jni/audioeffect/android_media_AudioEffect.cpp index b16372d..cb2f0f9 100644 --- a/media/jni/audioeffect/android_media_AudioEffect.cpp +++ b/media/jni/audioeffect/android_media_AudioEffect.cpp @@ -304,14 +304,7 @@ android_media_AudioEffect_native_setup(JNIEnv *env, jobject thiz, jobject weak_t lpJniStorage->mCallbackData.audioEffect_class, &lpJniStorage->mCallbackData); - if (jId) { - nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL); - if (nId == NULL) { - LOGE("setup: Error retrieving id pointer"); - lStatus = AUDIOEFFECT_ERROR_BAD_VALUE; - goto setup_failure; - } - } else { + if (jId == NULL) { LOGE("setup: NULL java array for id pointer"); lStatus = AUDIOEFFECT_ERROR_BAD_VALUE; goto setup_failure; @@ -336,8 +329,13 @@ android_media_AudioEffect_native_setup(JNIEnv *env, jobject thiz, jobject weak_t goto setup_failure; } + nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL); + if (nId == NULL) { + LOGE("setup: Error retrieving id pointer"); + lStatus = AUDIOEFFECT_ERROR_BAD_VALUE; + goto setup_failure; + } nId[0] = lpAudioEffect->id(); - env->ReleasePrimitiveArrayCritical(jId, nId, 0); nId = NULL; |