OLD | NEW |
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/matched_filter_lag_aggregator.h" | 11 #include "webrtc/modules/audio_processing/aec3/matched_filter_lag_aggregator.h" |
12 | 12 |
13 #include <sstream> | 13 #include <sstream> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/array_view.h" | 17 #include "webrtc/base/array_view.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/test/gtest.h" | 20 #include "webrtc/test/gtest.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 namespace { | 23 namespace { |
24 | 24 |
25 void VerifyNoAggregateOutputForRepeatedLagAggregation( | 25 void VerifyNoAggregateOutputForRepeatedLagAggregation( |
26 size_t num_repetitions, | 26 size_t num_repetitions, |
27 rtc::ArrayView<const MatchedFilter::LagEstimate> lag_estimates, | 27 rtc::ArrayView<const MatchedFilter::LagEstimate> lag_estimates, |
28 MatchedFilterLagAggregator* aggregator) { | 28 MatchedFilterLagAggregator* aggregator) { |
29 for (size_t k = 0; k < num_repetitions; ++k) { | 29 for (size_t k = 0; k < num_repetitions; ++k) { |
30 EXPECT_FALSE(aggregator->Aggregate(lag_estimates)); | 30 EXPECT_FALSE(aggregator->Aggregate(lag_estimates)); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 constexpr size_t kThresholdForRequiredLagUpdatesInARow = 10; | 34 constexpr size_t kThresholdForRequiredLagUpdatesInARow = 10; |
35 constexpr size_t kThresholdForRequiredIdenticalLagAggregates = 10; | 35 constexpr size_t kThresholdForRequiredIdenticalLagAggregates = 15; |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 // Verifies that the most accurate lag estimate is chosen. | 39 // Verifies that the most accurate lag estimate is chosen. |
40 TEST(MatchedFilterLagAggregator, MostAccurateLagChosen) { | 40 TEST(MatchedFilterLagAggregator, MostAccurateLagChosen) { |
41 constexpr size_t kArtificialLag1 = 5; | 41 constexpr size_t kArtificialLag1 = 5; |
42 constexpr size_t kArtificialLag2 = 10; | 42 constexpr size_t kArtificialLag2 = 10; |
43 ApmDataDumper data_dumper(0); | 43 ApmDataDumper data_dumper(0); |
44 std::vector<MatchedFilter::LagEstimate> lag_estimates(2); | 44 std::vector<MatchedFilter::LagEstimate> lag_estimates(2); |
45 MatchedFilterLagAggregator aggregator(&data_dumper, lag_estimates.size()); | 45 MatchedFilterLagAggregator aggregator(&data_dumper, lag_estimates.size()); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 } | 183 } |
184 | 184 |
185 // Verifies the check for non-null data dumper. | 185 // Verifies the check for non-null data dumper. |
186 TEST(MatchedFilterLagAggregator, NullDataDumper) { | 186 TEST(MatchedFilterLagAggregator, NullDataDumper) { |
187 EXPECT_DEATH(MatchedFilterLagAggregator(nullptr, 1), ""); | 187 EXPECT_DEATH(MatchedFilterLagAggregator(nullptr, 1), ""); |
188 } | 188 } |
189 | 189 |
190 #endif | 190 #endif |
191 | 191 |
192 } // namespace webrtc | 192 } // namespace webrtc |
OLD | NEW |