summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioResamplerDyn.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-08-07 11:04:34 -0700
committerAndy Hung <hunga@google.com>2014-08-11 10:17:18 -0700
commitcd04484f4837b8ca0041d118286ab6a98e84fc75 (patch)
tree4b9e501bb71969c0ca5049201aeae42284ac9b80 /services/audioflinger/AudioResamplerDyn.cpp
parent53a1e46e559b00653eadf6f4bb5572679b0ee734 (diff)
downloadframeworks_av-cd04484f4837b8ca0041d118286ab6a98e84fc75.zip
frameworks_av-cd04484f4837b8ca0041d118286ab6a98e84fc75.tar.gz
frameworks_av-cd04484f4837b8ca0041d118286ab6a98e84fc75.tar.bz2
Extend downsampling ratios greater than 2:1
Also improve robustness to choice of sampling rate or buffer size such that increasing either by 10x does not cause overflow. Bug: 12979141 Bug: 15933066 Change-Id: If7989bd745d1bee3bdf811b8b7c978543ccafb65
Diffstat (limited to 'services/audioflinger/AudioResamplerDyn.cpp')
-rw-r--r--services/audioflinger/AudioResamplerDyn.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/audioflinger/AudioResamplerDyn.cpp b/services/audioflinger/AudioResamplerDyn.cpp
index 159ab70..0eeb201 100644
--- a/services/audioflinger/AudioResamplerDyn.cpp
+++ b/services/audioflinger/AudioResamplerDyn.cpp
@@ -393,7 +393,7 @@ void AudioResamplerDyn<TC, TI, TO>::setSampleRate(int32_t inSampleRate)
mPhaseFraction = static_cast<unsigned long long>(mPhaseFraction)
* phaseWrapLimit / oldPhaseWrapLimit;
mPhaseFraction %= phaseWrapLimit; // should not do anything, but just in case.
- mPhaseIncrement = static_cast<uint32_t>(static_cast<double>(phaseWrapLimit)
+ mPhaseIncrement = static_cast<uint32_t>(static_cast<uint64_t>(phaseWrapLimit)
* inSampleRate / mSampleRate);
// determine which resampler to use