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

Commit 761415bd authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Merge the calls to prepareTracks_l

Change-Id: I1dd759581333e2908d980180d44db7bf5ed6591d
parent ff249c0d
Loading
Loading
Loading
Loading
+7 −17
Original line number Diff line number Diff line
@@ -1993,12 +1993,8 @@ void AudioFlinger::PlaybackThread::checkSilentMode_l()

bool AudioFlinger::PlaybackThread::threadLoop()
{
    // MIXER || DUPLICATING
    Vector< sp<Track> > tracksToRemove;

    // DIRECT
    sp<Track> trackToRemove;

    standbyTime = systemTime();
    mixBufferSize = mFrameCount * mFrameSize;

@@ -2142,17 +2138,11 @@ if (mType == MIXER) {
                }
            }

// FIXME merge these
if (mType == MIXER || mType == DUPLICATING) {
            mixerStatus = prepareTracks_l(&tracksToRemove);
}
if (mType == DIRECT) {
            mixerStatus = threadLoop_prepareTracks_l(trackToRemove);
            // see FIXME in AudioFlinger.h
            if (mixerStatus == MIXER_CONTINUE) {
                continue;
            }
}

            // prevent any changes in effect chain list and in each effect chain
            // during mixing and effect process as the audio buffers could be deleted
@@ -2224,17 +2214,13 @@ if (mType == MIXER) {
        // finally let go of removed track(s), without the lock held
        // since we can't guarantee the destructors won't acquire that
        // same lock.
        tracksToRemove.clear();

// FIXME merge these
if (mType == MIXER) {
        tracksToRemove.clear();
}
if (mType == DIRECT) {
        trackToRemove.clear();
        activeTrack.clear();
}
if (mType == DUPLICATING) {
        tracksToRemove.clear();
        outputTracks.clear();
}

@@ -2852,10 +2838,12 @@ void AudioFlinger::DirectOutputThread::applyVolume()
    mRightVolShort = rightVol;
}

AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::threadLoop_prepareTracks_l(
    sp<Track>& trackToRemove
AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prepareTracks_l(
    Vector< sp<Track> > *tracksToRemove
)
{
    sp<Track> trackToRemove;

    // FIXME Temporarily renamed to avoid confusion with the member "mixerStatus"
    mixer_state mixerStatus_ = MIXER_IDLE;

@@ -2973,8 +2961,10 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::thre
        }
    }

    // FIXME merge this with similar code for removing multiple tracks
    // remove all the tracks that need to be...
    if (CC_UNLIKELY(trackToRemove != 0)) {
        tracksToRemove->add(trackToRemove);
        mActiveTracks.remove(trackToRemove);
        if (!mEffectChains.isEmpty()) {
            ALOGV("stopping track on chain %p for session Id: %d", effectChains[0].get(),
+7 −12
Original line number Diff line number Diff line
@@ -584,7 +584,7 @@ private:
            // standby mode does not have an enum value
            // suspend by audio policy manager is orthogonal to mixer state
#if 1
            // FIXME remove these hacks for threadLoop_prepareTracks_l
            // FIXME remove this hack for prepareTracks_l()
            , MIXER_CONTINUE        // "continue;"
#endif
        };
@@ -817,12 +817,11 @@ protected:
        // Non-trivial for DIRECT only
        virtual     void        applyVolume() { }

        // FIXME merge these
        // Non-trivial for MIXER and DUPLICATING only
        virtual     mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove) { return MIXER_IDLE; }
        // Non-trivial for DIRECT only
        virtual     mixer_state threadLoop_prepareTracks_l(sp<Track>& trackToRemove)
                                                                { return MIXER_IDLE; }
                    // prepareTracks_l reads and writes mActiveTracks, and also returns the
                    // pending set of tracks to remove via Vector 'tracksToRemove'.  The caller is
                    // responsible for clearing or destroying this Vector later on, when it
                    // is safe to do so. That will drop the final ref count and destroy the tracks.
        virtual     mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove) = 0;

public:

@@ -970,10 +969,6 @@ public:
        virtual     status_t    dumpInternals(int fd, const Vector<String16>& args);

    protected:
                    // prepareTracks_l reads and writes mActiveTracks, and also returns the
                    // pending set of tracks to remove via Vector 'tracksToRemove'.  The caller is
                    // responsible for clearing or destroying this Vector later on, when it
                    // is safe to do so. That will drop the final ref count and destroy the tracks.
        virtual     mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove);
        virtual     int         getTrackName_l();
        virtual     void        deleteTrackName_l(int name);
@@ -1006,7 +1001,7 @@ public:
        virtual     uint32_t    suspendSleepTimeUs();

        // threadLoop snippets
        virtual     mixer_state threadLoop_prepareTracks_l(sp<Track>& trackToRemove);
        virtual     mixer_state prepareTracks_l(Vector< sp<Track> > *tracksToRemove);
        virtual     void        threadLoop_mix();
        virtual     void        threadLoop_sleepTime();
        virtual     void        applyVolume();