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

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

Merge "Make openRecord_l more like createTrack_l for fast tracks: part 3"

parents b4429211 87970705
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -233,22 +233,27 @@ status_t AudioRecord::set(
    ALOGV("set(): mSessionId %d", mSessionId);

    mFlags = flags;
    mCbf = cbf;

    if (cbf != NULL) {
        mAudioRecordThread = new AudioRecordThread(*this, threadCanCallJava);
        mAudioRecordThread->run("AudioRecord", ANDROID_PRIORITY_AUDIO);
    }

    // create the IAudioRecord
    status = openRecord_l(0 /*epoch*/);

    if (status != NO_ERROR) {
        return status;
        if (mAudioRecordThread != 0) {
            mAudioRecordThread->requestExit();   // see comment in AudioRecord.h
            mAudioRecordThread->requestExitAndWait();
            mAudioRecordThread.clear();
        }

    if (cbf != NULL) {
        mAudioRecordThread = new AudioRecordThread(*this, threadCanCallJava);
        mAudioRecordThread->run("AudioRecord", ANDROID_PRIORITY_AUDIO);
        return status;
    }

    mStatus = NO_ERROR;

    mActive = false;
    mCbf = cbf;
    mUserData = user;
    // TODO: add audio hardware input latency here
    mLatency = (1000*mFrameCount) / sampleRate;