Increase the maximum supported sample rate to 384000 Hz and add tests
This CL increases the maximum supported sample rate so that all rates
up to 384000 Hz are handled.
The CL also adds tests that verifies that APM works as intended for
different combinations of number of channels and sample rates.
Bug: webrtc:10882
Change-Id: I98738e33ac21413ae00fec10bb43b8796ae2078c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150532
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29014}
diff --git a/modules/audio_processing/audio_buffer.cc b/modules/audio_processing/audio_buffer.cc
index 5ac4f94..4b0ca20 100644
--- a/modules/audio_processing/audio_buffer.cc
+++ b/modules/audio_processing/audio_buffer.cc
@@ -25,8 +25,7 @@
constexpr size_t kSamplesPer32kHzChannel = 320;
constexpr size_t kSamplesPer48kHzChannel = 480;
-constexpr size_t kSamplesPer192kHzChannel = 1920;
-constexpr size_t kMaxSamplesPerChannel = kSamplesPer192kHzChannel;
+constexpr size_t kMaxSamplesPerChannel = AudioBuffer::kMaxSampleRate / 100;
size_t NumBandsFromFramesPerChannel(size_t num_frames) {
if (num_frames == kSamplesPer32kHzChannel) {
@@ -123,7 +122,7 @@
const bool resampling_needed = input_num_frames_ != buffer_num_frames_;
if (downmix_needed) {
- RTC_DCHECK_GT(kMaxSamplesPerChannel, input_num_frames_);
+ RTC_DCHECK_GE(kMaxSamplesPerChannel, input_num_frames_);
std::array<float, kMaxSamplesPerChannel> downmix;
if (downmix_by_averaging_) {