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}
This commit is contained in:
Per Åhgren
2019-08-29 23:38:40 +02:00
committed by Commit Bot
parent 8577729a01
commit 3e8bf282c4
3 changed files with 151 additions and 3 deletions

View File

@ -25,8 +25,7 @@ namespace {
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 @@ void AudioBuffer::CopyFrom(const float* const* data,
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_) {