diff options
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r-- | services/audioflinger/Threads.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 822e490a5e..0bb2213798 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -7147,24 +7147,6 @@ reacquire_wakelock: ALOG_ASSERT(framesRead > 0); mFramesRead += framesRead; - if (audio_has_proportional_frames(mFormat) - && loopCount == lastLoopCountRead + 1) { - const int64_t readPeriodNs = lastIoEndNs - mLastIoEndNs; - const double jitterMs = - TimestampVerifier<int64_t, int64_t>::computeJitterMs( - {framesRead, readPeriodNs}, - {0, 0} /* lastTimestamp */, mSampleRate); - const double processMs = (lastIoBeginNs - mLastIoEndNs) * 1e-6; - - Mutex::Autolock _l(mLock); - mIoJitterMs.add(jitterMs); - mProcessTimeMs.add(processMs); - } - // update timing info. - mLastIoBeginNs = lastIoBeginNs; - mLastIoEndNs = lastIoEndNs; - lastLoopCountRead = loopCount; - #ifdef TEE_SINK (void)mTee.write((uint8_t*)mRsmpInBuffer + rear * mFrameSize, framesRead); #endif @@ -7324,6 +7306,23 @@ unlock: // enable changes in effect chain unlockEffectChains(effectChains); // effectChains doesn't need to be cleared, since it is cleared by destructor at scope end + if (audio_has_proportional_frames(mFormat) + && loopCount == lastLoopCountRead + 1) { + const int64_t readPeriodNs = lastIoEndNs - mLastIoEndNs; + const double jitterMs = + TimestampVerifier<int64_t, int64_t>::computeJitterMs( + {framesRead, readPeriodNs}, + {0, 0} /* lastTimestamp */, mSampleRate); + const double processMs = (lastIoBeginNs - mLastIoEndNs) * 1e-6; + + Mutex::Autolock _l(mLock); + mIoJitterMs.add(jitterMs); + mProcessTimeMs.add(processMs); + } + // update timing info. + mLastIoBeginNs = lastIoBeginNs; + mLastIoEndNs = lastIoEndNs; + lastLoopCountRead = loopCount; } standbyIfNotAlreadyInStandby(); |