From e44a84d85109e389867dd5e5f490018b727a8151 Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Wed, 30 Apr 2014 18:58:23 +0000 Subject: [PATCH] Only clamp to 16 kHz when AECM is enabled. Otherwise we could needlessly downsample to 16 kHz (rather than 32 kHz) when HW AEC is used. BUG=3259 R=bjornv@webrtc.org Review URL: https://webrtc-codereview.appspot.com/13429004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6033 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/modules/audio_processing/include/audio_processing.h | 5 ----- webrtc/voice_engine/transmit_mixer.cc | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index 68b679d66..6db1d12bc 100644 --- a/webrtc/modules/audio_processing/include/audio_processing.h +++ b/webrtc/modules/audio_processing/include/audio_processing.h @@ -61,12 +61,7 @@ struct ExperimentalAgc { bool enabled; }; -#if defined(ANDROID) || defined(IOS) -// AECM only supports 8kHz & 16kHz. -static const int kAudioProcMaxNativeSampleRateHz = 16000; -#else static const int kAudioProcMaxNativeSampleRateHz = 32000; -#endif // The Audio Processing Module (APM) provides a collection of voice processing // components designed for real-time communications software. diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc index cce2f9461..54faec91b 100644 --- a/webrtc/voice_engine/transmit_mixer.cc +++ b/webrtc/voice_engine/transmit_mixer.cc @@ -1173,7 +1173,12 @@ void TransmitMixer::GenerateAudioFrame(const int16_t* audio, // See: https://code.google.com/p/webrtc/issues/detail?id=3146 // When 48 kHz is supported natively by AudioProcessing, this will have // to be changed to handle 44.1 kHz. - codec_rate = std::min(codec_rate, kAudioProcMaxNativeSampleRateHz); + int max_sample_rate_hz = kAudioProcMaxNativeSampleRateHz; + if (audioproc_->echo_control_mobile()->is_enabled()) { + // AECM only supports 8 and 16 kHz. + max_sample_rate_hz = 16000; + } + codec_rate = std::min(codec_rate, max_sample_rate_hz); stereo_codec_ = num_codec_channels == 2; if (!mono_buffer_.get()) {