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

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

Merge "Isolate references to outputTracks/mOutputTracks"

parents f2eda12f fa26a859
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -2074,17 +2074,7 @@ if (mType == DIRECT) {

            }

if (mType == DUPLICATING) {
#if 0   // see earlier FIXME
            // Now that this is a field instead of local variable,
            // clear it so it is empty the first time through the loop,
            // and later an assignment could combine the clear with the loop below
            outputTracks.clear();
#endif
            for (size_t i = 0; i < mOutputTracks.size(); i++) {
                outputTracks.add(mOutputTracks[i]);
            }
}
            saveOutputTracks();

            // put audio hardware into standby after short delay
            if (CC_UNLIKELY((!mActiveTracks.size() && systemTime() > standbyTime) ||
@@ -2101,9 +2091,7 @@ if (mType == DUPLICATING) {
                    // we're about to wait, flush the binder command buffer
                    IPCThreadState::self()->flushCommands();

if (mType == DUPLICATING) {
                    outputTracks.clear();
}
                    clearOutputTracks();

                    if (exitPending()) break;

@@ -2212,9 +2200,10 @@ if (mType == MIXER) {
if (mType == DIRECT) {
        activeTrack.clear();
}
if (mType == DUPLICATING) {
        outputTracks.clear();
}
        // FIXME I don't understand the need for this here;
        //       it was in the original code but maybe the
        //       assignment in saveOutputTracks() makes this unnecessary?
        clearOutputTracks();

        // Effect chains will be actually deleted here if they were removed from
        // mEffectChains list during mixing or effects processing
@@ -3168,6 +3157,16 @@ void AudioFlinger::DuplicatingThread::threadLoop_standby()
    }
}

void AudioFlinger::DuplicatingThread::saveOutputTracks()
{
    outputTracks = mOutputTracks;
}

void AudioFlinger::DuplicatingThread::clearOutputTracks()
{
    outputTracks.clear();
}

void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread)
{
    Mutex::Autolock _l(mLock);
+8 −2
Original line number Diff line number Diff line
@@ -920,6 +920,10 @@ public:
        // Code snippets that are temporarily lifted up out of threadLoop() until the merge
                    void        checkSilentMode_l();

        // Non-trivial for DUPLICATING only
        virtual     void        saveOutputTracks() { }
        virtual     void        clearOutputTracks() { }

    private:

        friend class AudioFlinger;
@@ -972,9 +976,7 @@ public:
        // activeTrack was local to the while !exitingPending loop
        sp<Track>                       activeTrack;
        // DUPLICATING only
        SortedVector < sp<OutputTrack> >  outputTracks;
        uint32_t                        writeFrames;
        SortedVector < sp<OutputTrack> >  mOutputTracks;
    };

    class MixerThread : public PlaybackThread {
@@ -1070,9 +1072,13 @@ private:

        // called from threadLoop, addOutputTrack, removeOutputTrack
        virtual     void        updateWaitTime_l();
        virtual     void        saveOutputTracks();
        virtual     void        clearOutputTracks();
    private:

                    uint32_t    mWaitTimeMs;
        SortedVector < sp<OutputTrack> >  outputTracks;
        SortedVector < sp<OutputTrack> >  mOutputTracks;
    };

              PlaybackThread *checkPlaybackThread_l(audio_io_handle_t output) const;