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..376cf1edfbd54810c2742ec00411b022933dd447 100644 |
--- a/webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc |
+++ b/webrtc/modules/audio_processing/aec3/echo_canceller3_unittest.cc |
@@ -495,7 +495,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 +525,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 +539,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 +553,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 +569,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 +682,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 +726,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 +755,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 |