From 53c13f5281032650995e1bab9ab4232c932ae654 Mon Sep 17 00:00:00 2001 From: Satya Krishna Pindiproli Date: Tue, 3 Nov 2015 17:30:46 +0530 Subject: audioflinger: update multiplier logic to calculate frameCount If the value of the multiplier used in calculating mNormalFrameCount is odd, it is rounded off to a higher even value. This results in an increase of mNormalFrameCount and thereby the latency which is not expected. Do not prefer an even multiplier and let the value remain as is even if it is odd. CRs-Fixed: 931454 Change-Id: Ia60d87d01caef6f45998bffeafc3d6a24f7c7fb4 --- services/audioflinger/Threads.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'services/audioflinger') diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 71673c3..8c59282 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -2185,6 +2185,7 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l() kUseFastMixer == FastMixer_Dynamic)) { size_t minNormalFrameCount = (kMinNormalSinkBufferSizeMs * mSampleRate) / 1000; size_t maxNormalFrameCount = (kMaxNormalSinkBufferSizeMs * mSampleRate) / 1000; + // round up minimum and round down maximum to nearest 16 frames to satisfy AudioMixer minNormalFrameCount = (minNormalFrameCount + 15) & ~15; maxNormalFrameCount = maxNormalFrameCount & ~15; @@ -2200,19 +2201,6 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l() } else { multiplier = (double) maxNormalFrameCount / (double) mFrameCount; } - } else { - // prefer an even multiplier, for compatibility with doubling of fast tracks due to HAL - // SRC (it would be unusual for the normal sink buffer size to not be a multiple of fast - // track, but we sometimes have to do this to satisfy the maximum frame count - // constraint) - // FIXME this rounding up should not be done if no HAL SRC - uint32_t truncMult = (uint32_t) multiplier; - if ((truncMult & 1)) { - if ((truncMult + 1) * mFrameCount <= maxNormalFrameCount) { - ++truncMult; - } - } - multiplier = (double) truncMult; } } mNormalFrameCount = multiplier * mFrameCount; -- cgit v1.1