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

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

Merge "Revert "Swap the order of creating IAudioTrack and thread"" into jb-mr1-dev

parents 3411fc2f a997e7a7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -473,7 +473,7 @@ protected:
        friend class AudioTrack;
        virtual bool        threadLoop();
        AudioTrack& mReceiver;
        virtual ~AudioTrackThread();
        ~AudioTrackThread();
        Mutex               mMyLock;    // Thread::mLock is private
        Condition           mMyCond;    // Thread::mThreadExitedCondition is private
        bool                mPaused;    // whether thread is currently paused
+10 −5
Original line number Diff line number Diff line
@@ -278,6 +278,11 @@ status_t AudioTrack::set(
    mFlags = flags;
    mCbf = cbf;

    if (cbf != NULL) {
        mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
        mAudioTrackThread->run("AudioTrack", ANDROID_PRIORITY_AUDIO, 0 /*stack*/);
    }

    // create the IAudioTrack
    status_t status = createTrack_l(streamType,
                                  sampleRate,
@@ -287,13 +292,13 @@ status_t AudioTrack::set(
                                  flags,
                                  sharedBuffer,
                                  output);

    if (status != NO_ERROR) {
        return status;
        if (mAudioTrackThread != 0) {
            mAudioTrackThread->requestExit();
            mAudioTrackThread.clear();
        }

    if (cbf != NULL) {
        mAudioTrackThread = new AudioTrackThread(*this, threadCanCallJava);
        mAudioTrackThread->run("AudioTrack", ANDROID_PRIORITY_AUDIO);
        return status;
    }

    mStatus = NO_ERROR;