summaryrefslogtreecommitdiffstats
path: root/media/jni/audioeffect/android_media_Visualizer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/jni/audioeffect/android_media_Visualizer.cpp')
-rw-r--r--media/jni/audioeffect/android_media_Visualizer.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp
index 7b271ce..57cafd4 100644
--- a/media/jni/audioeffect/android_media_Visualizer.cpp
+++ b/media/jni/audioeffect/android_media_Visualizer.cpp
@@ -246,14 +246,7 @@ android_media_visualizer_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
lpJniStorage->mCallbackData.visualizer_class,
&lpJniStorage->mCallbackData);
- if (jId) {
- nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL);
- if (nId == NULL) {
- LOGE("setup: Error retrieving id pointer");
- lStatus = VISUALIZER_ERROR_BAD_VALUE;
- goto setup_failure;
- }
- } else {
+ if (jId == NULL) {
LOGE("setup: NULL java array for id pointer");
lStatus = VISUALIZER_ERROR_BAD_VALUE;
goto setup_failure;
@@ -275,8 +268,13 @@ android_media_visualizer_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
goto setup_failure;
}
+ nId = (jint *) env->GetPrimitiveArrayCritical(jId, NULL);
+ if (nId == NULL) {
+ LOGE("setup: Error retrieving id pointer");
+ lStatus = VISUALIZER_ERROR_BAD_VALUE;
+ goto setup_failure;
+ }
nId[0] = lpVisualizer->id();
-
env->ReleasePrimitiveArrayCritical(jId, nId, 0);
nId = NULL;
@@ -424,7 +422,6 @@ android_media_visualizer_native_getWaveForm(JNIEnv *env, jobject thiz, jbyteArra
jint status = translateError(lpVisualizer->getWaveForm((uint8_t *)nWaveform));
env->ReleasePrimitiveArrayCritical(jWaveform, nWaveform, 0);
-
return status;
}