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

Commit a997e7a7 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Revert "Swap the order of creating IAudioTrack and thread"

This reverts commit 5d464eb0.
It caused the wrong thread ID -1 to be passed to IAudioFlinger::createTrack().

Change-Id: Ic221d2bb4af572d3d2d752af19238c52f6728e3a
parent 8da4cd7d
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;