summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/audioflinger/AudioFlinger.cpp24
-rw-r--r--services/audioflinger/AudioFlinger.h19
2 files changed, 14 insertions, 29 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index d8a5d99..8deb2fe 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -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(),
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 336c777..edf083f 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -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();