summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Justin Ho <justinho@google.com> 2012-01-23 15:13:19 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2012-01-23 15:13:19 -0800
commitfeb1d988c8ea1a67a4edbf1914ea41ea73519e12 (patch)
tree1ec8d457cd2b0a1e7447ba25770624e7c4b3bc67
parentadd87f99d9ece26c776abe40297e9a49e08932d9 (diff)
parentfee5a860a8355cda071ff23644e943414ba7f65d (diff)
am fee5a860: Merge "DO NOT MERGE Revert "AudioFlinger: mix track only when really ready (2)"" into ics-mr1
* commit 'fee5a860a8355cda071ff23644e943414ba7f65d': DO NOT MERGE Revert "AudioFlinger: mix track only when really ready (2)"
-rw-r--r--services/audioflinger/AudioFlinger.cpp23
-rw-r--r--services/audioflinger/AudioFlinger.h4
2 files changed, 6 insertions, 21 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 697bcdf6d55b..e12a9854d8b3 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1832,7 +1832,7 @@ uint32_t AudioFlinger::PlaybackThread::activeSleepTimeUs()
AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device)
: PlaybackThread(audioFlinger, output, id, device),
- mAudioMixer(0), mPrevMixerStatus(MIXER_IDLE)
+ mAudioMixer(0)
{
mType = ThreadBase::MIXER;
mAudioMixer = new AudioMixer(mFrameCount, mSampleRate);
@@ -1945,7 +1945,6 @@ bool AudioFlinger::MixerThread::threadLoop()
ALOGV("MixerThread %p TID %d waking up\n", this, gettid());
acquireWakeLock_l();
- mPrevMixerStatus = MIXER_IDLE;
if (mMasterMute == false) {
char value[PROPERTY_VALUE_MAX];
property_get("ro.audio.silent", value, "0");
@@ -2104,11 +2103,11 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
// make sure that we have enough frames to mix one full buffer.
// enforce this condition only once to enable draining the buffer in case the client
// app does not call stop() and relies on underrun to stop:
- // hence the test on (mPrevMixerStatus == MIXER_TRACKS_READY) meaning the track was mixed
+ // hence the test on (track->mRetryCount >= kMaxTrackRetries) meaning the track was mixed
// during last round
uint32_t minFrames = 1;
if (!track->isStopped() && !track->isPausing() &&
- (mPrevMixerStatus == MIXER_TRACKS_READY)) {
+ (track->mRetryCount >= kMaxTrackRetries)) {
if (t->sampleRate() == (int)mSampleRate) {
minFrames = mFrameCount;
} else {
@@ -2230,13 +2229,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
// reset retry count
track->mRetryCount = kMaxTrackRetries;
- // If one track is ready, set the mixer ready if:
- // - the mixer was not ready during previous round OR
- // - no other track is not ready
- if (mPrevMixerStatus != MIXER_TRACKS_READY ||
- mixerStatus != MIXER_TRACKS_ENABLED) {
- mixerStatus = MIXER_TRACKS_READY;
- }
+ mixerStatus = MIXER_TRACKS_READY;
} else {
//ALOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
if (track->isStopped()) {
@@ -2254,11 +2247,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
tracksToRemove->add(track);
// indicate to client process that the track was disabled because of underrun
android_atomic_or(CBLK_DISABLED_ON, &cblk->flags);
- // If one track is not ready, mark the mixer also not ready if:
- // - the mixer was ready during previous round OR
- // - no other track is ready
- } else if (mPrevMixerStatus == MIXER_TRACKS_READY ||
- mixerStatus != MIXER_TRACKS_READY) {
+ } else if (mixerStatus != MIXER_TRACKS_READY) {
mixerStatus = MIXER_TRACKS_ENABLED;
}
}
@@ -2292,7 +2281,6 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
memset(mMixBuffer, 0, mFrameCount * mChannelCount * sizeof(int16_t));
}
- mPrevMixerStatus = mixerStatus;
return mixerStatus;
}
@@ -3028,7 +3016,6 @@ bool AudioFlinger::DuplicatingThread::threadLoop()
ALOGV("DuplicatingThread %p TID %d waking up\n", this, gettid());
acquireWakeLock_l();
- mPrevMixerStatus = MIXER_IDLE;
if (mMasterMute == false) {
char value[PROPERTY_VALUE_MAX];
property_get("ro.audio.silent", value, "0");
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 9bd2c7f49302..6cafa7ef7e7f 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -836,9 +836,7 @@ private:
virtual uint32_t idleSleepTimeUs();
virtual uint32_t suspendSleepTimeUs();
- AudioMixer* mAudioMixer;
- uint32_t mPrevMixerStatus; // previous status (mixer_state) returned by
- // prepareTracks_l()
+ AudioMixer* mAudioMixer;
};
class DirectOutputThread : public PlaybackThread {