Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae8c1264 authored by xiaomi/hanli's avatar xiaomi/hanli Committed by android-build-merger
Browse files

Merge "Fix local reference table overflow error."

am: fe87781f

Change-Id: I231ca7b7e7c5c35f805a4852ed7e1e57f09a9f92
parents 622d3051 fe87781f
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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: