@@ -1832,7 +1832,7 @@ uint32_t AudioFlinger::PlaybackThread::activeSleepTimeUs()
18321832
18331833AudioFlinger::MixerThread::MixerThread (const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, int id, uint32_t device)
18341834 : PlaybackThread(audioFlinger, output, id, device),
1835- mAudioMixer (0 ), mPrevMixerStatus(MIXER_IDLE)
1835+ mAudioMixer (0 )
18361836{
18371837 mType = ThreadBase::MIXER;
18381838 mAudioMixer = new AudioMixer (mFrameCount , mSampleRate );
@@ -1945,7 +1945,6 @@ bool AudioFlinger::MixerThread::threadLoop()
19451945 LOGV (" MixerThread %p TID %d waking up\n " , this , gettid ());
19461946 acquireWakeLock_l ();
19471947
1948- mPrevMixerStatus = MIXER_IDLE;
19491948 if (mMasterMute == false ) {
19501949 char value[PROPERTY_VALUE_MAX];
19511950 property_get (" ro.audio.silent" , value, " 0" );
@@ -2104,11 +2103,11 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
21042103 // make sure that we have enough frames to mix one full buffer.
21052104 // enforce this condition only once to enable draining the buffer in case the client
21062105 // app does not call stop() and relies on underrun to stop:
2107- // hence the test on (mPrevMixerStatus == MIXER_TRACKS_READY ) meaning the track was mixed
2106+ // hence the test on (track->mRetryCount >= kMaxTrackRetries ) meaning the track was mixed
21082107 // during last round
21092108 uint32_t minFrames = 1 ;
21102109 if (!track->isStopped () && !track->isPausing () &&
2111- (mPrevMixerStatus == MIXER_TRACKS_READY )) {
2110+ (track-> mRetryCount >= kMaxTrackRetries )) {
21122111 if (t->sampleRate () == (int )mSampleRate ) {
21132112 minFrames = mFrameCount ;
21142113 } else {
@@ -2230,13 +2229,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
22302229
22312230 // reset retry count
22322231 track->mRetryCount = kMaxTrackRetries ;
2233- // If one track is ready, set the mixer ready if:
2234- // - the mixer was not ready during previous round OR
2235- // - no other track is not ready
2236- if (mPrevMixerStatus != MIXER_TRACKS_READY ||
2237- mixerStatus != MIXER_TRACKS_ENABLED) {
2238- mixerStatus = MIXER_TRACKS_READY;
2239- }
2232+ mixerStatus = MIXER_TRACKS_READY;
22402233 } else {
22412234 // LOGV("track %d u=%08x, s=%08x [NOT READY] on thread %p", track->name(), cblk->user, cblk->server, this);
22422235 if (track->isStopped ()) {
@@ -2254,11 +2247,7 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
22542247 tracksToRemove->add (track);
22552248 // indicate to client process that the track was disabled because of underrun
22562249 android_atomic_or (CBLK_DISABLED_ON, &cblk->flags );
2257- // If one track is not ready, mark the mixer also not ready if:
2258- // - the mixer was ready during previous round OR
2259- // - no other track is ready
2260- } else if (mPrevMixerStatus == MIXER_TRACKS_READY ||
2261- mixerStatus != MIXER_TRACKS_READY) {
2250+ } else if (mixerStatus != MIXER_TRACKS_READY) {
22622251 mixerStatus = MIXER_TRACKS_ENABLED;
22632252 }
22642253 }
@@ -2292,7 +2281,6 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
22922281 memset (mMixBuffer , 0 , mFrameCount * mChannelCount * sizeof (int16_t ));
22932282 }
22942283
2295- mPrevMixerStatus = mixerStatus;
22962284 return mixerStatus;
22972285}
22982286
@@ -3028,7 +3016,6 @@ bool AudioFlinger::DuplicatingThread::threadLoop()
30283016 LOGV (" DuplicatingThread %p TID %d waking up\n " , this , gettid ());
30293017 acquireWakeLock_l ();
30303018
3031- mPrevMixerStatus = MIXER_IDLE;
30323019 if (mMasterMute == false ) {
30333020 char value[PROPERTY_VALUE_MAX];
30343021 property_get (" ro.audio.silent" , value, " 0" );
0 commit comments