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

Side by Side Diff: webrtc/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: Fixed compilation error 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
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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
11 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h" 11 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <sstream> 14 #include <sstream>
15 #include <string> 15 #include <string>
16 16
17 #include "webrtc/base/random.h" 17 #include "webrtc/base/random.h"
18 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h" 18 #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
19 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" 19 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
20 #include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h" 20 #include "webrtc/modules/audio_processing/test/echo_canceller_test_tools.h"
21 #include "webrtc/test/gtest.h" 21 #include "webrtc/test/gtest.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 namespace { 24 namespace {
25 25
26 std::string ProduceDebugText(size_t delay) { 26 std::string ProduceDebugText(size_t delay) {
27 std::ostringstream ss; 27 std::ostringstream ss;
28 ss << "Delay: " << delay; 28 ss << "Delay: " << delay;
(...skipping 13 matching lines...) Expand all
42 } 42 }
43 } 43 }
44 44
45 // Verifies that the delay estimator produces correct delay for artificially 45 // Verifies that the delay estimator produces correct delay for artificially
46 // delayed signals. 46 // delayed signals.
47 TEST(EchoPathDelayEstimator, DelayEstimation) { 47 TEST(EchoPathDelayEstimator, DelayEstimation) {
48 Random random_generator(42U); 48 Random random_generator(42U);
49 std::vector<float> render(kBlockSize, 0.f); 49 std::vector<float> render(kBlockSize, 0.f);
50 std::vector<float> capture(kBlockSize, 0.f); 50 std::vector<float> capture(kBlockSize, 0.f);
51 ApmDataDumper data_dumper(0); 51 ApmDataDumper data_dumper(0);
52 for (size_t delay_samples : {0, 64, 150, 200, 800, 4000}) { 52 for (size_t delay_samples : {15, 64, 150, 200, 800, 4000}) {
53 SCOPED_TRACE(ProduceDebugText(delay_samples)); 53 SCOPED_TRACE(ProduceDebugText(delay_samples));
54 DelayBuffer<float> signal_delay_buffer(delay_samples); 54 DelayBuffer<float> signal_delay_buffer(delay_samples);
55 EchoPathDelayEstimator estimator(&data_dumper); 55 EchoPathDelayEstimator estimator(&data_dumper);
56 56
57 rtc::Optional<size_t> estimated_delay_samples; 57 rtc::Optional<size_t> estimated_delay_samples;
58 for (size_t k = 0; k < (100 + delay_samples / kBlockSize); ++k) { 58 for (size_t k = 0; k < (100 + delay_samples / kBlockSize); ++k) {
59 RandomizeSampleVector(&random_generator, render); 59 RandomizeSampleVector(&random_generator, render);
60 signal_delay_buffer.Delay(render, capture); 60 signal_delay_buffer.Delay(render, capture);
61 estimated_delay_samples = estimator.EstimateDelay(render, capture); 61 estimated_delay_samples = estimator.EstimateDelay(render, capture);
62 } 62 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 // Verifies the check for non-null data dumper. 147 // Verifies the check for non-null data dumper.
148 TEST(EchoPathDelayEstimator, NullDataDumper) { 148 TEST(EchoPathDelayEstimator, NullDataDumper) {
149 EXPECT_DEATH(EchoPathDelayEstimator(nullptr), ""); 149 EXPECT_DEATH(EchoPathDelayEstimator(nullptr), "");
150 } 150 }
151 151
152 #endif 152 #endif
153 153
154 } // namespace webrtc 154 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698