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

Commit 1dd51aba authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Use set() return value instead of separate call to initCheck()"

parents e1791add c5d14242
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
    lpCallbackData->audioRecord_ref = env->NewGlobalRef(weak_this);
    lpCallbackData->busy = false;

    lpRecorder->set((audio_source_t) source,
    const status_t status = lpRecorder->set((audio_source_t) source,
        sampleRateInHertz,
        format,        // word length, PCM
        channelMask,
@@ -231,7 +231,6 @@ android_media_AudioRecord_setup(JNIEnv *env, jobject thiz, jobject weak_this,
        true,          // threadCanCallJava
        sessionId);

    const status_t status = lpRecorder->initCheck();
    if (status != NO_ERROR) {
        ALOGE("Error creating AudioRecord instance: initialization check failed with status %d.",
                status);
+5 −4
Original line number Diff line number Diff line
@@ -304,10 +304,11 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
    lpJniStorage->mCallbackData.busy = false;

    // initialize the native AudioTrack object
    status_t status;
    switch (memoryMode) {
    case MODE_STREAM:

        lpTrack->set(
        status = lpTrack->set(
            atStreamType,// stream type
            sampleRateInHertz,
            format,// word length, PCM
@@ -329,7 +330,7 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
            goto native_init_failure;
        }

        lpTrack->set(
        status = lpTrack->set(
            atStreamType,// stream type
            sampleRateInHertz,
            format,// word length, PCM
@@ -348,8 +349,8 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
        goto native_init_failure;
    }

    if (lpTrack->initCheck() != NO_ERROR) {
        ALOGE("Error initializing AudioTrack");
    if (status != NO_ERROR) {
        ALOGE("Error %d initializing AudioTrack", status);
        goto native_init_failure;
    }