Added unittest to the AEC3 BlockProcessor class that tests longer calls

Bug: webrtc:8671
Change-Id: I64c416af5b0269e7bbe59702199b30b6b20b6807
Reviewed-on: https://webrtc-review.googlesource.com/55861
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22136}
This commit is contained in:
Per Åhgren
2018-02-21 00:24:05 +01:00
committed by Commit Bot
parent d5a272ff51
commit bbfccfd9e0

View File

@ -35,15 +35,17 @@ using testing::_;
// Verifies that the basic BlockProcessor functionality works and that the API
// methods are callable.
void RunBasicSetupAndApiCallTest(int sample_rate_hz) {
void RunBasicSetupAndApiCallTest(int sample_rate_hz, int num_iterations) {
std::unique_ptr<BlockProcessor> block_processor(
BlockProcessor::Create(EchoCanceller3Config(), sample_rate_hz));
std::vector<std::vector<float>> block(NumBandsForRate(sample_rate_hz),
std::vector<float>(kBlockSize, 0.f));
std::vector<float>(kBlockSize, 1000.f));
block_processor->BufferRender(block);
block_processor->ProcessCapture(false, false, &block);
block_processor->UpdateEchoLeakageStatus(false);
for (int k = 0; k < num_iterations; ++k) {
block_processor->BufferRender(block);
block_processor->ProcessCapture(false, false, &block);
block_processor->UpdateEchoLeakageStatus(false);
}
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
@ -193,10 +195,14 @@ TEST(BlockProcessor, DISABLED_SubmoduleIntegration) {
TEST(BlockProcessor, BasicSetupAndApiCalls) {
for (auto rate : {8000, 16000, 32000, 48000}) {
SCOPED_TRACE(ProduceDebugText(rate));
RunBasicSetupAndApiCallTest(rate);
RunBasicSetupAndApiCallTest(rate, 1);
}
}
TEST(BlockProcessor, TestLongerCall) {
RunBasicSetupAndApiCallTest(16000, 20 * kNumBlocksPerSecond);
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
// TODO(gustaf): Re-enable the test once the issue with memory leaks during
// DEATH tests on test bots has been fixed.