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

Commit e1a8a719 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioFlinger: mix track only when really ready" into ics-mr1

parents 49e82712 3dbe3201
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2066,7 +2066,16 @@ uint32_t AudioFlinger::MixerThread::prepareTracks_l(const SortedVector< wp<Track
        // The first time a track is added we wait
        // for all its buffers to be filled before processing it
        mAudioMixer->setActiveTrack(track->name());
        if (cblk->framesReady() && track->isReady() &&
        // make sure that we have enough frames to mix one full buffer
        uint32_t minFrames = 1;
        if (!track->isStopped() && !track->isPausing()) {
            if (t->sampleRate() == (int)mSampleRate) {
                minFrames = mFrameCount;
            } else {
                minFrames = (mFrameCount * t->sampleRate()) / mSampleRate + 1;
            }
        }
        if ((cblk->framesReady() >= minFrames) && track->isReady() &&
                !track->isPaused() && !track->isTerminated())
        {
            //LOGV("track %d u=%08x, s=%08x [OK] on thread %p", track->name(), cblk->user, cblk->server, this);