Enable built-in echo canceler if available.

1. Always initialize AudioRecord with VOICE_COMMUNICATION.
2. If echo canceler is available, disable our echo suppressor.

Change-Id: Idf18d3833189a8478c1b252ebe6ce55e923280b3
This commit is contained in:
Chia-chi Yeh
2011-01-06 17:43:24 +08:00
parent 4bf82df2f0
commit d87be273aa

View File

@@ -484,7 +484,7 @@ private:
ON_HOLD = 0,
MUTED = 1,
NORMAL = 2,
EC_ENABLED = 3,
ECHO_SUPPRESSION = 3,
LAST_MODE = 3,
};
@@ -619,6 +619,10 @@ bool AudioGroup::setMode(int mode)
if (mode < 0 || mode > LAST_MODE) {
return false;
}
if (mode == ECHO_SUPPRESSION && AudioSystem::getParameters(
0, String8("ec_supported")) == "ec_supported=yes") {
mode = NORMAL;
}
if (mMode == mode) {
return true;
}
@@ -775,8 +779,8 @@ bool AudioGroup::DeviceThread::threadLoop()
AudioTrack track;
AudioRecord record;
if (track.set(AudioSystem::VOICE_CALL, sampleRate, AudioSystem::PCM_16_BIT,
AudioSystem::CHANNEL_OUT_MONO, output) != NO_ERROR ||
record.set(AUDIO_SOURCE_MIC, sampleRate, AudioSystem::PCM_16_BIT,
AudioSystem::CHANNEL_OUT_MONO, output) != NO_ERROR || record.set(
AUDIO_SOURCE_VOICE_COMMUNICATION, sampleRate, AudioSystem::PCM_16_BIT,
AudioSystem::CHANNEL_IN_MONO, input) != NO_ERROR) {
LOGE("cannot initialize audio device");
return false;