OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 1, | 150 1, |
151 fullband_frame_length_, | 151 fullband_frame_length_, |
152 1, | 152 1, |
153 fullband_frame_length_) {} | 153 fullband_frame_length_) {} |
154 | 154 |
155 // Verifies that the capture data is properly received by the block processor | 155 // Verifies that the capture data is properly received by the block processor |
156 // and that the processor data is properly passed to the EchoCanceller3 | 156 // and that the processor data is properly passed to the EchoCanceller3 |
157 // output. | 157 // output. |
158 void RunCaptureTransportVerificationTest() { | 158 void RunCaptureTransportVerificationTest() { |
159 EchoCanceller3 aec3( | 159 EchoCanceller3 aec3( |
160 sample_rate_hz_, false, | 160 AudioProcessing::Config::EchoCanceller3(), sample_rate_hz_, false, |
161 std::unique_ptr<BlockProcessor>( | 161 std::unique_ptr<BlockProcessor>( |
162 new CaptureTransportVerificationProcessor(num_bands_))); | 162 new CaptureTransportVerificationProcessor(num_bands_))); |
163 | 163 |
164 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; | 164 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; |
165 ++frame_index) { | 165 ++frame_index) { |
166 aec3.AnalyzeCapture(&capture_buffer_); | 166 aec3.AnalyzeCapture(&capture_buffer_); |
167 OptionalBandSplit(); | 167 OptionalBandSplit(); |
168 PopulateInputFrame(frame_length_, num_bands_, frame_index, | 168 PopulateInputFrame(frame_length_, num_bands_, frame_index, |
169 &capture_buffer_.split_bands_f(0)[0], 0); | 169 &capture_buffer_.split_bands_f(0)[0], 0); |
170 PopulateInputFrame(frame_length_, frame_index, | 170 PopulateInputFrame(frame_length_, frame_index, |
171 &render_buffer_.channels_f()[0][0], 0); | 171 &render_buffer_.channels_f()[0][0], 0); |
172 | 172 |
173 aec3.AnalyzeRender(&render_buffer_); | 173 aec3.AnalyzeRender(&render_buffer_); |
174 aec3.ProcessCapture(&capture_buffer_, false); | 174 aec3.ProcessCapture(&capture_buffer_, false); |
175 EXPECT_TRUE(VerifyOutputFrameBitexactness( | 175 EXPECT_TRUE(VerifyOutputFrameBitexactness( |
176 frame_length_, num_bands_, frame_index, | 176 frame_length_, num_bands_, frame_index, |
177 &capture_buffer_.split_bands_f(0)[0], -64)); | 177 &capture_buffer_.split_bands_f(0)[0], -64)); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 // Test method for testing that the render data is properly received by the | 181 // Test method for testing that the render data is properly received by the |
182 // block processor. | 182 // block processor. |
183 void RunRenderTransportVerificationTest() { | 183 void RunRenderTransportVerificationTest() { |
184 EchoCanceller3 aec3( | 184 EchoCanceller3 aec3( |
185 sample_rate_hz_, false, | 185 AudioProcessing::Config::EchoCanceller3(), sample_rate_hz_, false, |
186 std::unique_ptr<BlockProcessor>( | 186 std::unique_ptr<BlockProcessor>( |
187 new RenderTransportVerificationProcessor(num_bands_))); | 187 new RenderTransportVerificationProcessor(num_bands_))); |
188 | 188 |
189 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; | 189 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; |
190 ++frame_index) { | 190 ++frame_index) { |
191 aec3.AnalyzeCapture(&capture_buffer_); | 191 aec3.AnalyzeCapture(&capture_buffer_); |
192 OptionalBandSplit(); | 192 OptionalBandSplit(); |
193 PopulateInputFrame(frame_length_, num_bands_, frame_index, | 193 PopulateInputFrame(frame_length_, num_bands_, frame_index, |
194 &capture_buffer_.split_bands_f(0)[0], 100); | 194 &capture_buffer_.split_bands_f(0)[0], 100); |
195 PopulateInputFrame(frame_length_, num_bands_, frame_index, | 195 PopulateInputFrame(frame_length_, num_bands_, frame_index, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 .Times(expected_num_block_to_process); | 239 .Times(expected_num_block_to_process); |
240 break; | 240 break; |
241 case EchoPathChangeTestVariant::kOneNonSticky: | 241 case EchoPathChangeTestVariant::kOneNonSticky: |
242 EXPECT_CALL(*block_processor_mock, ProcessCapture(true, _, _)) | 242 EXPECT_CALL(*block_processor_mock, ProcessCapture(true, _, _)) |
243 .Times(num_full_blocks_per_frame); | 243 .Times(num_full_blocks_per_frame); |
244 EXPECT_CALL(*block_processor_mock, ProcessCapture(false, _, _)) | 244 EXPECT_CALL(*block_processor_mock, ProcessCapture(false, _, _)) |
245 .Times(expected_num_block_to_process - num_full_blocks_per_frame); | 245 .Times(expected_num_block_to_process - num_full_blocks_per_frame); |
246 break; | 246 break; |
247 } | 247 } |
248 | 248 |
249 EchoCanceller3 aec3(sample_rate_hz_, false, | 249 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 250 sample_rate_hz_, false, |
250 std::move(block_processor_mock)); | 251 std::move(block_processor_mock)); |
251 | 252 |
252 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; | 253 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; |
253 ++frame_index) { | 254 ++frame_index) { |
254 bool echo_path_change = false; | 255 bool echo_path_change = false; |
255 switch (echo_path_change_test_variant) { | 256 switch (echo_path_change_test_variant) { |
256 case EchoPathChangeTestVariant::kNone: | 257 case EchoPathChangeTestVariant::kNone: |
257 break; | 258 break; |
258 case EchoPathChangeTestVariant::kOneSticky: | 259 case EchoPathChangeTestVariant::kOneSticky: |
259 echo_path_change = true; | 260 echo_path_change = true; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 break; | 322 break; |
322 case EchoLeakageTestVariant::kTrueNonSticky: { | 323 case EchoLeakageTestVariant::kTrueNonSticky: { |
323 testing::InSequence s; | 324 testing::InSequence s; |
324 EXPECT_CALL(*block_processor_mock, UpdateEchoLeakageStatus(true)) | 325 EXPECT_CALL(*block_processor_mock, UpdateEchoLeakageStatus(true)) |
325 .Times(1); | 326 .Times(1); |
326 EXPECT_CALL(*block_processor_mock, UpdateEchoLeakageStatus(false)) | 327 EXPECT_CALL(*block_processor_mock, UpdateEchoLeakageStatus(false)) |
327 .Times(kNumFramesToProcess - 1); | 328 .Times(kNumFramesToProcess - 1); |
328 } break; | 329 } break; |
329 } | 330 } |
330 | 331 |
331 EchoCanceller3 aec3(sample_rate_hz_, false, | 332 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 333 sample_rate_hz_, false, |
332 std::move(block_processor_mock)); | 334 std::move(block_processor_mock)); |
333 | 335 |
334 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; | 336 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; |
335 ++frame_index) { | 337 ++frame_index) { |
336 switch (leakage_report_variant) { | 338 switch (leakage_report_variant) { |
337 case EchoLeakageTestVariant::kNone: | 339 case EchoLeakageTestVariant::kNone: |
338 break; | 340 break; |
339 case EchoLeakageTestVariant::kFalseSticky: | 341 case EchoLeakageTestVariant::kFalseSticky: |
340 if (frame_index == 0) { | 342 if (frame_index == 0) { |
341 aec3.UpdateEchoLeakageStatus(false); | 343 aec3.UpdateEchoLeakageStatus(false); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } break; | 412 } break; |
411 case SaturationTestVariant::kOnePositive: { | 413 case SaturationTestVariant::kOnePositive: { |
412 testing::InSequence s; | 414 testing::InSequence s; |
413 EXPECT_CALL(*block_processor_mock, ProcessCapture(_, true, _)) | 415 EXPECT_CALL(*block_processor_mock, ProcessCapture(_, true, _)) |
414 .Times(num_full_blocks_per_frame); | 416 .Times(num_full_blocks_per_frame); |
415 EXPECT_CALL(*block_processor_mock, ProcessCapture(_, false, _)) | 417 EXPECT_CALL(*block_processor_mock, ProcessCapture(_, false, _)) |
416 .Times(expected_num_block_to_process - num_full_blocks_per_frame); | 418 .Times(expected_num_block_to_process - num_full_blocks_per_frame); |
417 } break; | 419 } break; |
418 } | 420 } |
419 | 421 |
420 EchoCanceller3 aec3(sample_rate_hz_, false, | 422 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 423 sample_rate_hz_, false, |
421 std::move(block_processor_mock)); | 424 std::move(block_processor_mock)); |
422 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; | 425 for (size_t frame_index = 0; frame_index < kNumFramesToProcess; |
423 ++frame_index) { | 426 ++frame_index) { |
424 for (int k = 0; k < fullband_frame_length_; ++k) { | 427 for (int k = 0; k < fullband_frame_length_; ++k) { |
425 capture_buffer_.channels_f()[0][k] = 0.f; | 428 capture_buffer_.channels_f()[0][k] = 0.f; |
426 } | 429 } |
427 switch (saturation_variant) { | 430 switch (saturation_variant) { |
428 case SaturationTestVariant::kNone: | 431 case SaturationTestVariant::kNone: |
429 break; | 432 break; |
430 case SaturationTestVariant::kOneNegative: | 433 case SaturationTestVariant::kOneNegative: |
(...skipping 18 matching lines...) Expand all Loading... |
449 | 452 |
450 aec3.AnalyzeRender(&render_buffer_); | 453 aec3.AnalyzeRender(&render_buffer_); |
451 aec3.ProcessCapture(&capture_buffer_, false); | 454 aec3.ProcessCapture(&capture_buffer_, false); |
452 } | 455 } |
453 } | 456 } |
454 | 457 |
455 // This test verifies that the swapqueue is able to handle jitter in the | 458 // This test verifies that the swapqueue is able to handle jitter in the |
456 // capture and render API calls. | 459 // capture and render API calls. |
457 void RunRenderSwapQueueVerificationTest() { | 460 void RunRenderSwapQueueVerificationTest() { |
458 EchoCanceller3 aec3( | 461 EchoCanceller3 aec3( |
459 sample_rate_hz_, false, | 462 AudioProcessing::Config::EchoCanceller3(), sample_rate_hz_, false, |
460 std::unique_ptr<BlockProcessor>( | 463 std::unique_ptr<BlockProcessor>( |
461 new RenderTransportVerificationProcessor(num_bands_))); | 464 new RenderTransportVerificationProcessor(num_bands_))); |
462 | 465 |
463 for (size_t frame_index = 0; frame_index < kRenderTransferQueueSize; | 466 for (size_t frame_index = 0; frame_index < kRenderTransferQueueSize; |
464 ++frame_index) { | 467 ++frame_index) { |
465 if (sample_rate_hz_ > 16000) { | 468 if (sample_rate_hz_ > 16000) { |
466 render_buffer_.SplitIntoFrequencyBands(); | 469 render_buffer_.SplitIntoFrequencyBands(); |
467 } | 470 } |
468 PopulateInputFrame(frame_length_, num_bands_, frame_index, | 471 PopulateInputFrame(frame_length_, num_bands_, frame_index, |
469 &render_buffer_.split_bands_f(0)[0], 0); | 472 &render_buffer_.split_bands_f(0)[0], 0); |
(...skipping 18 matching lines...) Expand all Loading... |
488 aec3.ProcessCapture(&capture_buffer_, false); | 491 aec3.ProcessCapture(&capture_buffer_, false); |
489 EXPECT_TRUE(VerifyOutputFrameBitexactness( | 492 EXPECT_TRUE(VerifyOutputFrameBitexactness( |
490 frame_length_, num_bands_, frame_index, | 493 frame_length_, num_bands_, frame_index, |
491 &capture_buffer_.split_bands_f(0)[0], -64)); | 494 &capture_buffer_.split_bands_f(0)[0], -64)); |
492 } | 495 } |
493 } | 496 } |
494 | 497 |
495 // This test verifies that a buffer overrun in the render swapqueue is | 498 // This test verifies that a buffer overrun in the render swapqueue is |
496 // properly reported. | 499 // properly reported. |
497 void RunRenderPipelineSwapQueueOverrunReturnValueTest() { | 500 void RunRenderPipelineSwapQueueOverrunReturnValueTest() { |
498 EchoCanceller3 aec3(sample_rate_hz_, false); | 501 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 502 sample_rate_hz_, false); |
499 | 503 |
500 constexpr size_t kRenderTransferQueueSize = 30; | 504 constexpr size_t kRenderTransferQueueSize = 30; |
501 for (size_t k = 0; k < 2; ++k) { | 505 for (size_t k = 0; k < 2; ++k) { |
502 for (size_t frame_index = 0; frame_index < kRenderTransferQueueSize; | 506 for (size_t frame_index = 0; frame_index < kRenderTransferQueueSize; |
503 ++frame_index) { | 507 ++frame_index) { |
504 if (sample_rate_hz_ > 16000) { | 508 if (sample_rate_hz_ > 16000) { |
505 render_buffer_.SplitIntoFrequencyBands(); | 509 render_buffer_.SplitIntoFrequencyBands(); |
506 } | 510 } |
507 PopulateInputFrame(frame_length_, frame_index, | 511 PopulateInputFrame(frame_length_, frame_index, |
508 &render_buffer_.channels_f()[0][0], 0); | 512 &render_buffer_.channels_f()[0][0], 0); |
509 | 513 |
510 if (k == 0) { | 514 if (k == 0) { |
511 aec3.AnalyzeRender(&render_buffer_); | 515 aec3.AnalyzeRender(&render_buffer_); |
512 } else { | 516 } else { |
513 aec3.AnalyzeRender(&render_buffer_); | 517 aec3.AnalyzeRender(&render_buffer_); |
514 } | 518 } |
515 } | 519 } |
516 } | 520 } |
517 } | 521 } |
518 | 522 |
519 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 523 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
520 // Verifies the that the check for the number of bands in the AnalyzeRender | 524 // Verifies the that the check for the number of bands in the AnalyzeRender |
521 // input is correct by adjusting the sample rates of EchoCanceller3 and the | 525 // input is correct by adjusting the sample rates of EchoCanceller3 and the |
522 // input AudioBuffer to have a different number of bands. | 526 // input AudioBuffer to have a different number of bands. |
523 void RunAnalyzeRenderNumBandsCheckVerification() { | 527 void RunAnalyzeRenderNumBandsCheckVerification() { |
524 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a | 528 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a |
525 // way that the number of bands for the rates are different. | 529 // way that the number of bands for the rates are different. |
526 const int aec3_sample_rate_hz = sample_rate_hz_ == 48000 ? 32000 : 48000; | 530 const int aec3_sample_rate_hz = sample_rate_hz_ == 48000 ? 32000 : 48000; |
527 EchoCanceller3 aec3(aec3_sample_rate_hz, false); | 531 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 532 aec3_sample_rate_hz, false); |
528 PopulateInputFrame(frame_length_, 0, &render_buffer_.channels_f()[0][0], 0); | 533 PopulateInputFrame(frame_length_, 0, &render_buffer_.channels_f()[0][0], 0); |
529 | 534 |
530 EXPECT_DEATH(aec3.AnalyzeRender(&render_buffer_), ""); | 535 EXPECT_DEATH(aec3.AnalyzeRender(&render_buffer_), ""); |
531 } | 536 } |
532 | 537 |
533 // Verifies the that the check for the number of bands in the ProcessCapture | 538 // Verifies the that the check for the number of bands in the ProcessCapture |
534 // input is correct by adjusting the sample rates of EchoCanceller3 and the | 539 // input is correct by adjusting the sample rates of EchoCanceller3 and the |
535 // input AudioBuffer to have a different number of bands. | 540 // input AudioBuffer to have a different number of bands. |
536 void RunProcessCaptureNumBandsCheckVerification() { | 541 void RunProcessCaptureNumBandsCheckVerification() { |
537 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a | 542 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a |
538 // way that the number of bands for the rates are different. | 543 // way that the number of bands for the rates are different. |
539 const int aec3_sample_rate_hz = sample_rate_hz_ == 48000 ? 32000 : 48000; | 544 const int aec3_sample_rate_hz = sample_rate_hz_ == 48000 ? 32000 : 48000; |
540 EchoCanceller3 aec3(aec3_sample_rate_hz, false); | 545 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 546 aec3_sample_rate_hz, false); |
541 PopulateInputFrame(frame_length_, num_bands_, 0, | 547 PopulateInputFrame(frame_length_, num_bands_, 0, |
542 &capture_buffer_.split_bands_f(0)[0], 100); | 548 &capture_buffer_.split_bands_f(0)[0], 100); |
543 EXPECT_DEATH(aec3.ProcessCapture(&capture_buffer_, false), ""); | 549 EXPECT_DEATH(aec3.ProcessCapture(&capture_buffer_, false), ""); |
544 } | 550 } |
545 | 551 |
546 // Verifies the that the check for the frame length in the AnalyzeRender input | 552 // Verifies the that the check for the frame length in the AnalyzeRender input |
547 // is correct by adjusting the sample rates of EchoCanceller3 and the input | 553 // is correct by adjusting the sample rates of EchoCanceller3 and the input |
548 // AudioBuffer to have a different frame lengths. | 554 // AudioBuffer to have a different frame lengths. |
549 void RunAnalyzeRenderFrameLengthCheckVerification() { | 555 void RunAnalyzeRenderFrameLengthCheckVerification() { |
550 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a | 556 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a |
551 // way that the band frame lengths are different. | 557 // way that the band frame lengths are different. |
552 const int aec3_sample_rate_hz = sample_rate_hz_ == 8000 ? 16000 : 8000; | 558 const int aec3_sample_rate_hz = sample_rate_hz_ == 8000 ? 16000 : 8000; |
553 EchoCanceller3 aec3(aec3_sample_rate_hz, false); | 559 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 560 aec3_sample_rate_hz, false); |
554 | 561 |
555 OptionalBandSplit(); | 562 OptionalBandSplit(); |
556 PopulateInputFrame(frame_length_, 0, &render_buffer_.channels_f()[0][0], 0); | 563 PopulateInputFrame(frame_length_, 0, &render_buffer_.channels_f()[0][0], 0); |
557 | 564 |
558 EXPECT_DEATH(aec3.AnalyzeRender(&render_buffer_), ""); | 565 EXPECT_DEATH(aec3.AnalyzeRender(&render_buffer_), ""); |
559 } | 566 } |
560 | 567 |
561 // Verifies the that the check for the frame length in the AnalyzeRender input | 568 // Verifies the that the check for the frame length in the AnalyzeRender input |
562 // is correct by adjusting the sample rates of EchoCanceller3 and the input | 569 // is correct by adjusting the sample rates of EchoCanceller3 and the input |
563 // AudioBuffer to have a different frame lengths. | 570 // AudioBuffer to have a different frame lengths. |
564 void RunProcessCaptureFrameLengthCheckVerification() { | 571 void RunProcessCaptureFrameLengthCheckVerification() { |
565 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a | 572 // Set aec3_sample_rate_hz to be different from sample_rate_hz_ in such a |
566 // way that the band frame lengths are different. | 573 // way that the band frame lengths are different. |
567 const int aec3_sample_rate_hz = sample_rate_hz_ == 8000 ? 16000 : 8000; | 574 const int aec3_sample_rate_hz = sample_rate_hz_ == 8000 ? 16000 : 8000; |
568 EchoCanceller3 aec3(aec3_sample_rate_hz, false); | 575 EchoCanceller3 aec3(AudioProcessing::Config::EchoCanceller3(), |
| 576 aec3_sample_rate_hz, false); |
569 | 577 |
570 OptionalBandSplit(); | 578 OptionalBandSplit(); |
571 PopulateInputFrame(frame_length_, num_bands_, 0, | 579 PopulateInputFrame(frame_length_, num_bands_, 0, |
572 &capture_buffer_.split_bands_f(0)[0], 100); | 580 &capture_buffer_.split_bands_f(0)[0], 100); |
573 | 581 |
574 EXPECT_DEATH(aec3.ProcessCapture(&capture_buffer_, false), ""); | 582 EXPECT_DEATH(aec3.ProcessCapture(&capture_buffer_, false), ""); |
575 } | 583 } |
576 | 584 |
577 #endif | 585 #endif |
578 | 586 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 EchoCanceller3Tester::EchoLeakageTestVariant::kTrueSticky, | 678 EchoCanceller3Tester::EchoLeakageTestVariant::kTrueSticky, |
671 EchoCanceller3Tester::EchoLeakageTestVariant::kTrueNonSticky}; | 679 EchoCanceller3Tester::EchoLeakageTestVariant::kTrueNonSticky}; |
672 for (auto rate : {8000, 16000, 32000, 48000}) { | 680 for (auto rate : {8000, 16000, 32000, 48000}) { |
673 for (auto variant : variants) { | 681 for (auto variant : variants) { |
674 SCOPED_TRACE(ProduceDebugText(rate, static_cast<int>(variant))); | 682 SCOPED_TRACE(ProduceDebugText(rate, static_cast<int>(variant))); |
675 EchoCanceller3Tester(rate).RunEchoLeakageVerificationTest(variant); | 683 EchoCanceller3Tester(rate).RunEchoLeakageVerificationTest(variant); |
676 } | 684 } |
677 } | 685 } |
678 } | 686 } |
679 | 687 |
| 688 TEST(EchoCanceller3, ConfigValidation) { |
| 689 AudioProcessing::Config::EchoCanceller3 config; |
| 690 |
| 691 config.echo_decay = 0.f; |
| 692 EXPECT_TRUE(EchoCanceller3::Validate(config)); |
| 693 config.echo_decay = 0.9f; |
| 694 EXPECT_TRUE(EchoCanceller3::Validate(config)); |
| 695 config.echo_decay = -0.1f; |
| 696 EXPECT_FALSE(EchoCanceller3::Validate(config)); |
| 697 config.echo_decay = 1.0f; |
| 698 EXPECT_FALSE(EchoCanceller3::Validate(config)); |
| 699 config.echo_decay = 1.1f; |
| 700 EXPECT_FALSE(EchoCanceller3::Validate(config)); |
| 701 } |
| 702 |
680 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 703 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
681 | 704 |
682 TEST(EchoCanceller3InputCheck, WrongCaptureNumBandsCheckVerification) { | 705 TEST(EchoCanceller3InputCheck, WrongCaptureNumBandsCheckVerification) { |
683 for (auto rate : {8000, 16000, 32000, 48000}) { | 706 for (auto rate : {8000, 16000, 32000, 48000}) { |
684 SCOPED_TRACE(ProduceDebugText(rate)); | 707 SCOPED_TRACE(ProduceDebugText(rate)); |
685 EchoCanceller3Tester(rate).RunProcessCaptureNumBandsCheckVerification(); | 708 EchoCanceller3Tester(rate).RunProcessCaptureNumBandsCheckVerification(); |
686 } | 709 } |
687 } | 710 } |
688 | 711 |
689 // TODO(peah): Re-enable the test once the issue with memory leaks during DEATH | 712 // TODO(peah): Re-enable the test once the issue with memory leaks during DEATH |
690 // tests on test bots has been fixed. | 713 // tests on test bots has been fixed. |
691 TEST(EchoCanceller3InputCheck, | 714 TEST(EchoCanceller3InputCheck, |
692 DISABLED_WrongRenderFrameLengthCheckVerification) { | 715 DISABLED_WrongRenderFrameLengthCheckVerification) { |
693 for (auto rate : {8000, 16000}) { | 716 for (auto rate : {8000, 16000}) { |
694 SCOPED_TRACE(ProduceDebugText(rate)); | 717 SCOPED_TRACE(ProduceDebugText(rate)); |
695 EchoCanceller3Tester(rate).RunAnalyzeRenderFrameLengthCheckVerification(); | 718 EchoCanceller3Tester(rate).RunAnalyzeRenderFrameLengthCheckVerification(); |
696 } | 719 } |
697 } | 720 } |
698 | 721 |
699 TEST(EchoCanceller3InputCheck, WrongCaptureFrameLengthCheckVerification) { | 722 TEST(EchoCanceller3InputCheck, WrongCaptureFrameLengthCheckVerification) { |
700 for (auto rate : {8000, 16000}) { | 723 for (auto rate : {8000, 16000}) { |
701 SCOPED_TRACE(ProduceDebugText(rate)); | 724 SCOPED_TRACE(ProduceDebugText(rate)); |
702 EchoCanceller3Tester(rate).RunProcessCaptureFrameLengthCheckVerification(); | 725 EchoCanceller3Tester(rate).RunProcessCaptureFrameLengthCheckVerification(); |
703 } | 726 } |
704 } | 727 } |
705 | 728 |
706 // Verifiers that the verification for null input to the render analysis api | 729 // Verifiers that the verification for null input to the render analysis api |
707 // call works. | 730 // call works. |
708 TEST(EchoCanceller3InputCheck, NullRenderAnalysisParameter) { | 731 TEST(EchoCanceller3InputCheck, NullRenderAnalysisParameter) { |
709 EXPECT_DEATH(EchoCanceller3(8000, false).AnalyzeRender(nullptr), ""); | 732 EXPECT_DEATH( |
| 733 EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8000, false) |
| 734 .AnalyzeRender(nullptr), |
| 735 ""); |
710 } | 736 } |
711 | 737 |
712 // Verifiers that the verification for null input to the capture analysis api | 738 // Verifiers that the verification for null input to the capture analysis api |
713 // call works. | 739 // call works. |
714 TEST(EchoCanceller3InputCheck, NullCaptureAnalysisParameter) { | 740 TEST(EchoCanceller3InputCheck, NullCaptureAnalysisParameter) { |
715 EXPECT_DEATH(EchoCanceller3(8000, false).AnalyzeCapture(nullptr), ""); | 741 EXPECT_DEATH( |
| 742 EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8000, false) |
| 743 .AnalyzeCapture(nullptr), |
| 744 ""); |
716 } | 745 } |
717 | 746 |
718 // Verifiers that the verification for null input to the capture processing api | 747 // Verifiers that the verification for null input to the capture processing api |
719 // call works. | 748 // call works. |
720 TEST(EchoCanceller3InputCheck, NullCaptureProcessingParameter) { | 749 TEST(EchoCanceller3InputCheck, NullCaptureProcessingParameter) { |
721 EXPECT_DEATH(EchoCanceller3(8000, false).ProcessCapture(nullptr, false), ""); | 750 EXPECT_DEATH( |
| 751 EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8000, false) |
| 752 .ProcessCapture(nullptr, false), |
| 753 ""); |
722 } | 754 } |
723 | 755 |
724 // Verifies the check for correct sample rate. | 756 // Verifies the check for correct sample rate. |
725 // TODO(peah): Re-enable the test once the issue with memory leaks during DEATH | 757 // TODO(peah): Re-enable the test once the issue with memory leaks during DEATH |
726 // tests on test bots has been fixed. | 758 // tests on test bots has been fixed. |
727 TEST(EchoCanceller3InputCheck, DISABLED_WrongSampleRate) { | 759 TEST(EchoCanceller3InputCheck, DISABLED_WrongSampleRate) { |
728 ApmDataDumper data_dumper(0); | 760 ApmDataDumper data_dumper(0); |
729 EXPECT_DEATH(EchoCanceller3(8001, false), ""); | 761 EXPECT_DEATH( |
| 762 EchoCanceller3(AudioProcessing::Config::EchoCanceller3(), 8001, false), |
| 763 ""); |
730 } | 764 } |
731 | 765 |
732 #endif | 766 #endif |
733 | 767 |
734 } // namespace webrtc | 768 } // namespace webrtc |
OLD | NEW |