summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioResampler.cpp
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2014-01-30 14:32:31 -0800
committerAndy Hung <hunga@google.com>2014-01-30 16:19:21 -0800
commit9e0308c03d4e76d3146cbb6e30aeb3ac03f05cf5 (patch)
treef64a6d90e2e6d2e45fa83a72422d08b3751c3914 /services/audioflinger/AudioResampler.cpp
parente983e0a0017fce81dc3d9bea36f5abb7b7bce40b (diff)
downloadframeworks_av-9e0308c03d4e76d3146cbb6e30aeb3ac03f05cf5.zip
frameworks_av-9e0308c03d4e76d3146cbb6e30aeb3ac03f05cf5.tar.gz
frameworks_av-9e0308c03d4e76d3146cbb6e30aeb3ac03f05cf5.tar.bz2
Enable new dynamic audio resampler as default
The default may still be overridden by af.resampler.quality in the local or build properties file. For the build properties check the relevant device.mk files. In the absence of being overridden, the 44.1 to 48kHz and 48 to 44.1kHz conversion will use the DYN_MED_QUALITY resamplers and other conversion will use the DYN_LOW_QUALITY resamplers. Change-Id: Icf9a4af5422cddc445e1904eef93984b0abe6a44 Signed-off-by: Andy Hung <hunga@google.com>
Diffstat (limited to 'services/audioflinger/AudioResampler.cpp')
-rw-r--r--services/audioflinger/AudioResampler.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 24ff55d..8573e47 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -158,6 +158,16 @@ AudioResampler* AudioResampler::create(int bitDepth, int inChannelCount,
atFinalQuality = true;
}
+ /* if the caller requests DEFAULT_QUALITY and af.resampler.property
+ * has not been set, the target resampler quality is set to DYN_MED_QUALITY,
+ * and allowed to "throttle" down to DYN_LOW_QUALITY if necessary
+ * due to estimated CPU load of having too many active resamplers
+ * (the code below the if).
+ */
+ if (quality == DEFAULT_QUALITY) {
+ quality = DYN_MED_QUALITY;
+ }
+
// naive implementation of CPU load throttling doesn't account for whether resampler is active
pthread_mutex_lock(&mutex);
for (;;) {
@@ -172,7 +182,6 @@ AudioResampler* AudioResampler::create(int bitDepth, int inChannelCount,
// not enough CPU available for proposed quality level, so try next lowest level
switch (quality) {
default:
- case DEFAULT_QUALITY:
case LOW_QUALITY:
atFinalQuality = true;
break;
@@ -202,7 +211,6 @@ AudioResampler* AudioResampler::create(int bitDepth, int inChannelCount,
switch (quality) {
default:
- case DEFAULT_QUALITY:
case LOW_QUALITY:
ALOGV("Create linear Resampler");
resampler = new AudioResamplerOrder1(bitDepth, inChannelCount, sampleRate);