Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Unified Diff: webrtc/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc

Issue 2611223003: Adding second layer of the echo canceller 3 functionality. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
diff --git a/webrtc/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc b/webrtc/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3950192e3627eef74b6e62aef2c2b63e13f2e480
--- /dev/null
+++ b/webrtc/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
hlundin-webrtc 2017/01/18 13:08:49 2017
peah-webrtc 2017/01/19 15:33:05 Done.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h"
+
+#include <sstream>
+#include <string>
+
+#include "webrtc/modules/audio_processing/aec3/aec3_constants.h"
+#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
+#include "webrtc/test/gtest.h"
+
+namespace webrtc {
+namespace {
+
+std::string ProduceDebugText(int sample_rate_hz) {
+ std::ostringstream ss;
+ ss << "Sample rate: " << sample_rate_hz;
+ return ss.str();
+}
+
+} // namespace
+
+// Verifies that the basic API calls work.
+TEST(EchoPathDelayEstimator, BasicApiCalls) {
+ for (auto rate : {8000, 16000, 32000, 48000}) {
+ ProduceDebugText(rate);
+ ApmDataDumper data_dumper(0);
+ EchoPathDelayEstimator estimator(&data_dumper, rate);
+ std::vector<float> render(std::vector<float>(kBlockSize, 0.f));
+ std::vector<float> capture(std::vector<float>(kBlockSize, 0.f));
+ for (size_t k = 0; k < 100; ++k) {
+ estimator.EstimateDelay(render, capture);
+ }
+ }
+}
+
+#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
+
+// Verifies the check for correct sample rate.
+TEST(EchoPathDelayEstimator, WrongSampleRate) {
+ ApmDataDumper data_dumper(0);
+ EXPECT_DEATH(EchoPathDelayEstimator remover(&data_dumper, 8001), "");
+}
+
+// Verifies the check for the render blocksize.
+TEST(EchoPathDelayEstimator, WrongRenderBlockSize) {
+ for (auto rate : {8000, 16000, 32000, 48000}) {
+ ProduceDebugText(rate);
+ ApmDataDumper data_dumper(0);
+ EchoPathDelayEstimator estimator(&data_dumper, rate);
+ std::vector<float> render(std::vector<float>(kBlockSize - 1, 0.f));
+ std::vector<float> capture(std::vector<float>(kBlockSize, 0.f));
+ EXPECT_DEATH(estimator.EstimateDelay(render, capture), "");
+ }
+}
+
+// Verifies the check for the capture blocksize.
+TEST(EchoPathDelayEstimator, WrongCaptureBlockSize) {
+ for (auto rate : {8000, 16000, 32000, 48000}) {
+ ProduceDebugText(rate);
+ ApmDataDumper data_dumper(0);
+ EchoPathDelayEstimator estimator(&data_dumper, rate);
+ std::vector<float> render(std::vector<float>(kBlockSize - 1, 0.f));
hlundin-webrtc 2017/01/18 13:08:49 Copy-paste error; modifying the render block size
peah-webrtc 2017/01/19 15:33:05 Great find! Done.
+ std::vector<float> capture(std::vector<float>(kBlockSize, 0.f));
+ EXPECT_DEATH(estimator.EstimateDelay(render, capture), "");
+ }
+}
+
+// Verifies the check for non-null data dumper.
+TEST(EchoPathDelayEstimator, NullDataDumper) {
+ for (auto rate : {16000, 32000, 48000}) {
hlundin-webrtc 2017/01/18 13:08:49 No need to do this for more than one sample rate.
peah-webrtc 2017/01/19 15:33:05 Done.
+ ProduceDebugText(rate);
+ EXPECT_DEATH(EchoPathDelayEstimator(nullptr, rate), "");
+ }
+}
+
+#endif
+
+} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698