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

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

Merge "Clear mAudioRecord and mAudioTrack on set() failure" into mnc-dev

parents 098f9836 3e98ecd1
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -85,12 +85,18 @@ int JetPlayer::init()

    // create the output AudioTrack
    mAudioTrack = new AudioTrack();
    mAudioTrack->set(AUDIO_STREAM_MUSIC,  //TODO parameterize this
    status_t status = mAudioTrack->set(AUDIO_STREAM_MUSIC,  //TODO parameterize this
            pLibConfig->sampleRate,
            AUDIO_FORMAT_PCM_16_BIT,
            audio_channel_out_mask_from_count(pLibConfig->numChannels),
            (size_t) mTrackBufferSize,
            AUDIO_OUTPUT_FLAG_NONE);
    if (status != OK) {
        ALOGE("JetPlayer::init(): Error initializing JET library; AudioTrack error %d", status);
        mAudioTrack.clear();
        mState = EAS_STATE_ERROR;
        return EAS_FAILURE;
    }

    // create render and playback thread
    {
+1 −0
Original line number Diff line number Diff line
@@ -1628,6 +1628,7 @@ status_t MediaPlayerService::AudioOutput::open(
        if ((t == 0) || (t->initCheck() != NO_ERROR)) {
            ALOGE("Unable to create audio track");
            delete newcbd;
            // t goes out of scope, so reference count drops to zero
            return NO_INIT;
        } else {
            // successful AudioTrack initialization implies a legacy stream type was generated
+3 −0
Original line number Diff line number Diff line
@@ -85,6 +85,9 @@ AudioSource::AudioSource(
                    this,
                    frameCount /*notificationFrames*/);
        mInitCheck = mRecord->initCheck();
        if (mInitCheck != OK) {
            mRecord.clear();
        }
    } else {
        mInitCheck = status;
    }