summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-09-24 13:46:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-24 13:46:36 -0700
commitf3ae63eef2d7f55c793b2e76d1371f82cea0aab7 (patch)
tree018c99080859bcff29f7bc4771add1b53cbd7ccf /core
parent6c48f228f10c63f83c25fc0c86a5a739266c61a9 (diff)
parent52f58e96a723a56e6619c237c814a07503745de9 (diff)
downloadframeworks_base-f3ae63eef2d7f55c793b2e76d1371f82cea0aab7.zip
frameworks_base-f3ae63eef2d7f55c793b2e76d1371f82cea0aab7.tar.gz
frameworks_base-f3ae63eef2d7f55c793b2e76d1371f82cea0aab7.tar.bz2
am 52f58e96: Merge "fix problem in AudioEffect JNI setup." into gingerbread
Merge commit '52f58e96a723a56e6619c237c814a07503745de9' into gingerbread-plus-aosp * commit '52f58e96a723a56e6619c237c814a07503745de9': fix problem in AudioEffect JNI setup.
Diffstat (limited to 'core')
-rw-r--r--core/jni/android_media_AudioTrack.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 9d215b7..8409adc 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -252,21 +252,23 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
lpJniStorage->mCallbackData.audioTrack_ref = env->NewGlobalRef(weak_this);
lpJniStorage->mStreamType = atStreamType;
-
- jint* nSession = NULL;
- if (jSession) {
- nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
- if (nSession == NULL) {
- LOGE("Error creating AudioTrack: Error retrieving session id pointer");
- delete lpJniStorage;
- return AUDIOTRACK_ERROR;
- }
- } else {
+
+ if (jSession == NULL) {
LOGE("Error creating AudioTrack: invalid session ID pointer");
delete lpJniStorage;
return AUDIOTRACK_ERROR;
}
+ jint* nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
+ if (nSession == NULL) {
+ LOGE("Error creating AudioTrack: Error retrieving session id pointer");
+ delete lpJniStorage;
+ return AUDIOTRACK_ERROR;
+ }
+ int sessionId = nSession[0];
+ env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
+ nSession = NULL;
+
// create the native AudioTrack object
AudioTrack* lpTrack = new AudioTrack();
if (lpTrack == NULL) {
@@ -288,7 +290,7 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
0,// shared mem
true,// thread can call Java
- nSession[0]);// audio session ID
+ sessionId);// audio session ID
} else if (memoryMode == javaAudioTrackFields.MODE_STATIC) {
// AudioTrack is using shared memory
@@ -309,7 +311,7 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
lpJniStorage->mMemBase,// shared mem
true,// thread can call Java
- nSession[0]);// audio session ID
+ sessionId);// audio session ID
}
if (lpTrack->initCheck() != NO_ERROR) {
@@ -317,9 +319,13 @@ android_media_AudioTrack_native_setup(JNIEnv *env, jobject thiz, jobject weak_th
goto native_init_failure;
}
+ nSession = (jint *) env->GetPrimitiveArrayCritical(jSession, NULL);
+ if (nSession == NULL) {
+ LOGE("Error creating AudioTrack: Error retrieving session id pointer");
+ goto native_init_failure;
+ }
// read the audio session ID back from AudioTrack in case we create a new session
nSession[0] = lpTrack->getSessionId();
-
env->ReleasePrimitiveArrayCritical(jSession, nSession, 0);
nSession = NULL;