Merge "Fix local reference table overflow error."

am: fe87781f40

Change-Id: I231ca7b7e7c5c35f805a4852ed7e1e57f09a9f92
This commit is contained in:
xiaomi/hanli
2018-11-01 13:19:28 -07:00
committed by android-build-merger

View File

@@ -951,6 +951,7 @@ static jint convertAudioPortFromNative(JNIEnv *env,
jintArray jFormats = NULL;
jobjectArray jGains = NULL;
jobject jHandle = NULL;
jobject jAudioPortConfig = NULL;
jstring jDeviceName = NULL;
bool useInMask;
size_t numPositionMasks = 0;
@@ -1129,7 +1130,6 @@ static jint convertAudioPortFromNative(JNIEnv *env,
goto exit;
}
jobject jAudioPortConfig;
jStatus = convertAudioPortConfigFromNative(env,
*jAudioPort,
&jAudioPortConfig,
@@ -1165,6 +1165,9 @@ exit:
if (jHandle != NULL) {
env->DeleteLocalRef(jHandle);
}
if (jAudioPortConfig != NULL) {
env->DeleteLocalRef(jAudioPortConfig);
}
return jStatus;
}
@@ -1235,12 +1238,15 @@ android_media_AudioSystem_listAudioPorts(JNIEnv *env, jobject clazz,
}
for (size_t i = 0; i < numPorts; i++) {
jobject jAudioPort;
jobject jAudioPort = NULL;
jStatus = convertAudioPortFromNative(env, &jAudioPort, &nPorts[i]);
if (jStatus != AUDIO_JAVA_SUCCESS) {
goto exit;
}
env->CallBooleanMethod(jPorts, gArrayListMethods.add, jAudioPort);
if (jAudioPort != NULL) {
env->DeleteLocalRef(jAudioPort);
}
}
exit: