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()) {