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 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 metric = EchoRemoverMetrics::DbMetric(1.f, 2.f, 3.f); | 120 metric = EchoRemoverMetrics::DbMetric(1.f, 2.f, 3.f); |
121 EXPECT_FLOAT_EQ(1.f, metric.sum_value); | 121 EXPECT_FLOAT_EQ(1.f, metric.sum_value); |
122 EXPECT_FLOAT_EQ(2.f, metric.floor_value); | 122 EXPECT_FLOAT_EQ(2.f, metric.floor_value); |
123 EXPECT_FLOAT_EQ(3.f, metric.ceil_value); | 123 EXPECT_FLOAT_EQ(3.f, metric.ceil_value); |
124 } | 124 } |
125 | 125 |
126 // Verify the general functionality of EchoRemoverMetrics. | 126 // Verify the general functionality of EchoRemoverMetrics. |
127 TEST(EchoRemoverMetrics, NormalUsage) { | 127 TEST(EchoRemoverMetrics, NormalUsage) { |
128 EchoRemoverMetrics metrics; | 128 EchoRemoverMetrics metrics; |
129 AecState aec_state; | 129 AecState aec_state(0.f); |
130 std::array<float, kFftLengthBy2Plus1> comfort_noise_spectrum; | 130 std::array<float, kFftLengthBy2Plus1> comfort_noise_spectrum; |
131 std::array<float, kFftLengthBy2Plus1> suppressor_gain; | 131 std::array<float, kFftLengthBy2Plus1> suppressor_gain; |
132 comfort_noise_spectrum.fill(10.f); | 132 comfort_noise_spectrum.fill(10.f); |
133 suppressor_gain.fill(1.f); | 133 suppressor_gain.fill(1.f); |
134 for (int j = 0; j < 3; ++j) { | 134 for (int j = 0; j < 3; ++j) { |
135 for (int k = 0; k < kMetricsReportingIntervalBlocks - 1; ++k) { | 135 for (int k = 0; k < kMetricsReportingIntervalBlocks - 1; ++k) { |
136 metrics.Update(aec_state, comfort_noise_spectrum, suppressor_gain); | 136 metrics.Update(aec_state, comfort_noise_spectrum, suppressor_gain); |
137 EXPECT_FALSE(metrics.MetricsReported()); | 137 EXPECT_FALSE(metrics.MetricsReported()); |
138 } | 138 } |
139 metrics.Update(aec_state, comfort_noise_spectrum, suppressor_gain); | 139 metrics.Update(aec_state, comfort_noise_spectrum, suppressor_gain); |
140 EXPECT_TRUE(metrics.MetricsReported()); | 140 EXPECT_TRUE(metrics.MetricsReported()); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 } // namespace webrtc | 144 } // namespace webrtc |
OLD | NEW |