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

Side by Side 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: Disabled DEATH tests that were causing memory leakage reports on test bots Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h"
12
13 #include <sstream>
14 #include <string>
15
16 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h"
17 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
18 #include "webrtc/test/gtest.h"
19
20 namespace webrtc {
21 namespace {
22
23 std::string ProduceDebugText(int sample_rate_hz) {
24 std::ostringstream ss;
25 ss << "Sample rate: " << sample_rate_hz;
26 return ss.str();
27 }
28
29 } // namespace
30
31 // Verifies that the basic API calls work.
32 TEST(EchoPathDelayEstimator, BasicApiCalls) {
33 for (auto rate : {8000, 16000, 32000, 48000}) {
34 ProduceDebugText(rate);
35 ApmDataDumper data_dumper(0);
36 EchoPathDelayEstimator estimator(&data_dumper, rate);
37 std::vector<float> render(kBlockSize, 0.f);
38 std::vector<float> capture(kBlockSize, 0.f);
39 for (size_t k = 0; k < 100; ++k) {
40 estimator.EstimateDelay(render, capture);
41 }
42 }
43 }
44
45 #if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
46
47 // Verifies the check for correct sample rate.
48 TEST(EchoPathDelayEstimator, WrongSampleRate) {
49 ApmDataDumper data_dumper(0);
50 EXPECT_DEATH(EchoPathDelayEstimator remover(&data_dumper, 8001), "");
51 }
52
53 // Verifies the check for the render blocksize.
54 // TODO(peah): Re-enable the test once the issue with memory leaks during DEATH
55 // tests on test bots has been fixed.
56 TEST(EchoPathDelayEstimator, DISABLED_WrongRenderBlockSize) {
57 for (auto rate : {8000, 16000, 32000, 48000}) {
58 ProduceDebugText(rate);
59 ApmDataDumper data_dumper(0);
60 EchoPathDelayEstimator estimator(&data_dumper, rate);
61 std::vector<float> render(kBlockSize - 1, 0.f);
62 std::vector<float> capture(kBlockSize, 0.f);
63 EXPECT_DEATH(estimator.EstimateDelay(render, capture), "");
64 }
65 }
66
67 // Verifies the check for the capture blocksize.
68 // TODO(peah): Re-enable the test once the issue with memory leaks during DEATH
69 // tests on test bots has been fixed.
70 TEST(EchoPathDelayEstimator, DISABLED_WrongCaptureBlockSize) {
71 for (auto rate : {8000, 16000, 32000, 48000}) {
72 ProduceDebugText(rate);
73 ApmDataDumper data_dumper(0);
74 EchoPathDelayEstimator estimator(&data_dumper, rate);
75 std::vector<float> render(kBlockSize, 0.f);
76 std::vector<float> capture(kBlockSize - 1, 0.f);
77 EXPECT_DEATH(estimator.EstimateDelay(render, capture), "");
78 }
79 }
80
81 // Verifies the check for non-null data dumper.
82 TEST(EchoPathDelayEstimator, NullDataDumper) {
83 EXPECT_DEATH(EchoPathDelayEstimator(nullptr, 8000), "");
84 }
85
86 #endif
87
88 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698