summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r--services/audioflinger/Threads.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index f93bd1dada..ae46e5dbd6 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -87,6 +87,10 @@
#include "postpro_patch.h"
#endif
+#ifdef MTK_HARDWARE
+#include "audioresampler/AudioResamplerMtkWrapper.h"
+#endif
+
// ----------------------------------------------------------------------------
// Note: the following macro is used for extremely verbose logging message. In
@@ -4944,8 +4948,13 @@ bool AudioFlinger::RecordThread::threadLoop()
upmix_to_stereo_i16_from_mono_i16((int16_t *)dst,
(int16_t *)src, framesIn);
} else {
+#if MTK_HARDWARE
+ MTK_downmix_to_mono_i16_from_stereo_i16((int16_t *)dst,
+ (int16_t *)src, framesIn);
+#else
downmix_to_mono_i16_from_stereo_i16((int16_t *)dst,
(int16_t *)src, framesIn);
+#endif
}
}
}
@@ -5028,8 +5037,13 @@ bool AudioFlinger::RecordThread::threadLoop()
ditherAndClamp(mRsmpOutBuffer, mRsmpOutBuffer, framesOut);
// the resampler always outputs stereo samples:
// do post stereo to mono conversion
+#ifdef MTK_HARDWARE
+ MTK_downmix_to_mono_i16_from_stereo_i16(buffer.i16, (int16_t *)mRsmpOutBuffer,
+ framesOut);
+#else
downmix_to_mono_i16_from_stereo_i16(buffer.i16, (int16_t *)mRsmpOutBuffer,
framesOut);
+#endif
} else {
ditherAndClamp((int32_t *)buffer.raw, mRsmpOutBuffer, framesOut);
}
@@ -5708,7 +5722,11 @@ void AudioFlinger::RecordThread::readInputParameters()
} else {
channelCount = 2;
}
+#ifdef MTK_HARDWARE
+ mResampler = AudioResampler::create(16, channelCount, mReqSampleRate, AudioResampler::MTK_QUALITY);
+#else
mResampler = AudioResampler::create(16, channelCount, mReqSampleRate);
+#endif
mResampler->setSampleRate(mSampleRate);
mResampler->setVolume(AudioMixer::UNITY_GAIN, AudioMixer::UNITY_GAIN);
mRsmpOutBuffer = new int32_t[mFrameCount * FCC_2];