summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.cpp
diff options
context:
space:
mode:
authorYamit Mehta <ymehta@codeaurora.org>2015-08-26 21:00:40 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:25:11 -0600
commit197cd79c6314ac2e14ce94624e21f3c4e38dca7c (patch)
tree84ee12ebdb6bab4cca5c07d5e58af1c23284505e /services/audioflinger/AudioMixer.cpp
parentdfee9b751a7c2b71fe87cd11162f717b898d6a21 (diff)
downloadframeworks_av-197cd79c6314ac2e14ce94624e21f3c4e38dca7c.zip
frameworks_av-197cd79c6314ac2e14ce94624e21f3c4e38dca7c.tar.gz
frameworks_av-197cd79c6314ac2e14ce94624e21f3c4e38dca7c.tar.bz2
audio: Audio resampler support for 192Khz playback
Add support for QTI audio resampler audio: Audio resampler support for 192Khz playback Change-Id: Ia8f24a0874ebf6e16ef7bd1f2759a14f47149875 audio: Add audio mixing support for qti resampler Change-Id: Ib657aa12b2a72323564148c302ff8891e1bb7433 AudioMixer: Extend use of QTI resampler for 44.1Khz sampling rate Change-Id: I2a819dbc9f1e3e280cb4fa79328e331883a3e981 AudioMixer: fill 0s at right place when no more buffers available Change-Id: I50504c5a02eb0c69abfc9b047792b0f6f85b9ce8 audioflinger: add channel count check to use QTI resampler Change-Id: I8f76dd82b72a0dd8b77343e77e0d0545e1be2114 Change-Id: Ia8f24a0874ebf6e16ef7bd1f2759a14f47149875
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r--services/audioflinger/AudioMixer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 8a9a837..27a2f65 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -85,6 +85,9 @@ static const bool kUseFloat = true;
// Set to default copy buffer size in frames for input processing.
static const size_t kCopyBufferFrameCount = 256;
+#ifdef QTI_RESAMPLER
+#define QTI_RESAMPLER_MAX_SAMPLERATE 192000
+#endif
namespace android {
// ----------------------------------------------------------------------------
@@ -779,6 +782,13 @@ bool AudioMixer::track_t::setResampler(uint32_t trackSampleRate, uint32_t devSam
// but if none exists, it is the channel count (1 for mono).
const int resamplerChannelCount = downmixerBufferProvider != NULL
? mMixerChannelCount : channelCount;
+#ifdef QTI_RESAMPLER
+ if ((trackSampleRate <= QTI_RESAMPLER_MAX_SAMPLERATE) &&
+ (trackSampleRate > devSampleRate * 2) &&
+ ((devSampleRate == 48000)||(devSampleRate == 44100))) {
+ quality = AudioResampler::QTI_QUALITY;
+ }
+#endif
ALOGVV("Creating resampler:"
" format(%#x) channels(%d) devSampleRate(%u) quality(%d)\n",
mMixerInFormat, resamplerChannelCount, devSampleRate, quality);
@@ -1644,6 +1654,9 @@ void AudioMixer::process__OneTrack16BitsStereoNoResampling(state_t* state,
// Note: In case of later int16_t sink output,
// conversion and clamping is done by memcpy_to_i16_from_float().
} while (--outFrames);
+ //assign fout to out, when no more frames are available, so that 0s
+ //can be filled at the right place
+ out = (int32_t *)fout;
break;
case AUDIO_FORMAT_PCM_16_BIT:
if (CC_UNLIKELY(uint32_t(vl) > UNITY_GAIN_INT || uint32_t(vr) > UNITY_GAIN_INT)) {