| Index: webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc
|
| diff --git a/webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc b/webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc
|
| index 78a10c006cd7ad76c9a0790ead80e5e7a5b4b8f6..5ad5b1c794b991034beebb759638df0bf0c9481b 100644
|
| --- a/webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc
|
| +++ b/webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc
|
| @@ -157,7 +157,7 @@ class EchoCanceller3Tester {
|
| // output.
|
| void RunCaptureTransportVerificationTest() {
|
| EchoCanceller3 aec3(
|
| - sample_rate_hz_, false,
|
| + AudioProcessing::Config::EchoCanceller3(), sample_rate_hz_, false,
|
| std::unique_ptr<BlockProcessor>(
|
| new CaptureTransportVerificationProcessor(num_bands_)));
|
|
|
| @@ -182,7 +182,7 @@ class EchoCanceller3Tester {
|
| // block processor.
|
| void RunRenderTransportVerificationTest() {
|
| EchoCanceller3 aec3(
|
| - sample_rate_hz_, false,
|
| + AudioProcessing::Config::EchoCanceller3(), sample_rate_hz_, false,
|
| std::unique_ptr<BlockProcessor>(
|
| new RenderTransportVerificationProcessor(num_bands_)));
|
|
|
| @@ -246,7 +246,8 @@ class EchoCanceller3Tester {
|
| break;
|
| }
|
|
|
| - EchoCanceller3 aec3(sample_rate_hz_, false,
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + sample_rate_hz_, false,
|
| std::move(block_processor_mock));
|
|
|
| for (size_t frame_index = 0; frame_index < kNumFramesToProcess;
|
| @@ -328,7 +329,8 @@ class EchoCanceller3Tester {
|
| } break;
|
| }
|
|
|
| - EchoCanceller3 aec3(sample_rate_hz_, false,
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + sample_rate_hz_, false,
|
| std::move(block_processor_mock));
|
|
|
| for (size_t frame_index = 0; frame_index < kNumFramesToProcess;
|
| @@ -417,7 +419,8 @@ class EchoCanceller3Tester {
|
| } break;
|
| }
|
|
|
| - EchoCanceller3 aec3(sample_rate_hz_, false,
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + sample_rate_hz_, false,
|
| std::move(block_processor_mock));
|
| for (size_t frame_index = 0; frame_index < kNumFramesToProcess;
|
| ++frame_index) {
|
| @@ -456,7 +459,7 @@ class EchoCanceller3Tester {
|
| // capture and render API calls.
|
| void RunRenderSwapQueueVerificationTest() {
|
| EchoCanceller3 aec3(
|
| - sample_rate_hz_, false,
|
| + AudioProcessing::Config::EchoCanceller3(), sample_rate_hz_, false,
|
| std::unique_ptr<BlockProcessor>(
|
| new RenderTransportVerificationProcessor(num_bands_)));
|
|
|
| @@ -495,7 +498,8 @@ class EchoCanceller3Tester {
|
| // This test verifies that a buffer overrun in the render swapqueue is
|
| // properly reported.
|
| void RunRenderPipelineSwapQueueOverrunReturnValueTest() {
|
| - EchoCanceller3 aec3(sample_rate_hz_, false);
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + sample_rate_hz_, false);
|
|
|
| constexpr size_t kRenderTransferQueueSize = 30;
|
| for (size_t k = 0; k < 2; ++k) {
|
| @@ -524,7 +528,8 @@ class EchoCanceller3Tester {
|
| // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a
|
| // way that the number of bands for the rates are different.
|
| const int aec3_sample_rate_hz = sample_rate_hz_ == 48000 ? 32000 : 48000;
|
| - EchoCanceller3 aec3(aec3_sample_rate_hz, false);
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + aec3_sample_rate_hz, false);
|
| PopulateInputFrame(frame_length_, 0, &render_buffer_.channels_f()[0][0], 0);
|
|
|
| EXPECT_DEATH(aec3.AnalyzeRender(&render_buffer_), "");
|
| @@ -537,7 +542,8 @@ class EchoCanceller3Tester {
|
| // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a
|
| // way that the number of bands for the rates are different.
|
| const int aec3_sample_rate_hz = sample_rate_hz_ == 48000 ? 32000 : 48000;
|
| - EchoCanceller3 aec3(aec3_sample_rate_hz, false);
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + aec3_sample_rate_hz, false);
|
| PopulateInputFrame(frame_length_, num_bands_, 0,
|
| &capture_buffer_.split_bands_f(0)[0], 100);
|
| EXPECT_DEATH(aec3.ProcessCapture(&capture_buffer_, false), "");
|
| @@ -550,7 +556,8 @@ class EchoCanceller3Tester {
|
| // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a
|
| // way that the band frame lengths are different.
|
| const int aec3_sample_rate_hz = sample_rate_hz_ == 8000 ? 16000 : 8000;
|
| - EchoCanceller3 aec3(aec3_sample_rate_hz, false);
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + aec3_sample_rate_hz, false);
|
|
|
| OptionalBandSplit();
|
| PopulateInputFrame(frame_length_, 0, &render_buffer_.channels_f()[0][0], 0);
|
| @@ -565,7 +572,8 @@ class EchoCanceller3Tester {
|
| // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a
|
| // way that the band frame lengths are different.
|
| const int aec3_sample_rate_hz = sample_rate_hz_ == 8000 ? 16000 : 8000;
|
| - EchoCanceller3 aec3(aec3_sample_rate_hz, false);
|
| + EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(),
|
| + aec3_sample_rate_hz, false);
|
|
|
| OptionalBandSplit();
|
| PopulateInputFrame(frame_length_, num_bands_, 0,
|
| @@ -677,6 +685,21 @@ TEST(EchoCanceller3Messaging, EchoLeakage) {
|
| }
|
| }
|
|
|
| +TEST(EchoCanceller3, ConfigValidation) {
|
| + AudioProcessing::Config::EchoCanceller3 config;
|
| +
|
| + config.echo_decay = 0.f;
|
| + EXPECT_TRUE(EchoCanceller3::Validate(config));
|
| + config.echo_decay = 0.9f;
|
| + EXPECT_TRUE(EchoCanceller3::Validate(config));
|
| + config.echo_decay = -0.1f;
|
| + EXPECT_FALSE(EchoCanceller3::Validate(config));
|
| + config.echo_decay = 1.0f;
|
| + EXPECT_FALSE(EchoCanceller3::Validate(config));
|
| + config.echo_decay = 1.1f;
|
| + EXPECT_FALSE(EchoCanceller3::Validate(config));
|
| +}
|
| +
|
| #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
|
|
| TEST(EchoCanceller3InputCheck, WrongCaptureNumBandsCheckVerification) {
|
| @@ -706,19 +729,28 @@ TEST(EchoCanceller3InputCheck, WrongCaptureFrameLengthCheckVerification) {
|
| // Verifiers that the verification for null input to the render analysis api
|
| // call works.
|
| TEST(EchoCanceller3InputCheck, NullRenderAnalysisParameter) {
|
| - EXPECT_DEATH(EchoCanceller3(8000, false).AnalyzeRender(nullptr), "");
|
| + EXPECT_DEATH(
|
| + EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8000, false)
|
| + .AnalyzeRender(nullptr),
|
| + "");
|
| }
|
|
|
| // Verifiers that the verification for null input to the capture analysis api
|
| // call works.
|
| TEST(EchoCanceller3InputCheck, NullCaptureAnalysisParameter) {
|
| - EXPECT_DEATH(EchoCanceller3(8000, false).AnalyzeCapture(nullptr), "");
|
| + EXPECT_DEATH(
|
| + EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8000, false)
|
| + .AnalyzeCapture(nullptr),
|
| + "");
|
| }
|
|
|
| // Verifiers that the verification for null input to the capture processing api
|
| // call works.
|
| TEST(EchoCanceller3InputCheck, NullCaptureProcessingParameter) {
|
| - EXPECT_DEATH(EchoCanceller3(8000, false).ProcessCapture(nullptr, false), "");
|
| + EXPECT_DEATH(
|
| + EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8000, false)
|
| + .ProcessCapture(nullptr, false),
|
| + "");
|
| }
|
|
|
| // Verifies the check for correct sample rate.
|
| @@ -726,7 +758,9 @@ TEST(EchoCanceller3InputCheck, NullCaptureProcessingParameter) {
|
| // tests on test bots has been fixed.
|
| TEST(EchoCanceller3InputCheck, DISABLED_WrongSampleRate) {
|
| ApmDataDumper data_dumper(0);
|
| - EXPECT_DEATH(EchoCanceller3(8001, false), "");
|
| + EXPECT_DEATH(
|
| + EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8001, false),
|
| + "");
|
| }
|
|
|
| #endif
|
|
|