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

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

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: 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/delay_handler.h"
12 #include "webrtc/test/gtest.h"
13
14 namespace webrtc {
15
16 TEST(DelayHandler, CorrectOperation) {
ivoc 2017/02/10 13:52:34 I think it makes sense to split this test up into
peah-webrtc 2017/02/20 07:37:16 Done.
17 constexpr int kFilterLength = 10;
18 DelayHandler handler;
19
20 std::vector<std::array<float, kFftLengthBy2Plus1>> frequency_response(
21 kFilterLength);
22 for (auto& v : frequency_response) {
23 v.fill(0.01f);
24 }
25
26 // Verify that a non-significant filter delay is identified correctly.
27 handler.UpdateDelays(frequency_response, rtc::Optional<size_t>());
28 EXPECT_FALSE(handler.FilterDelay());
29
30 // Verify that the filter delay for a converged filter is properly identified.
31 for (int k = 0; k < kFilterLength; ++k) {
32 for (auto& v : frequency_response) {
33 v.fill(0.01f);
34 }
35 frequency_response[k].fill(100.f);
36
37 handler.UpdateDelays(frequency_response, rtc::Optional<size_t>());
38 EXPECT_TRUE(k == (kFilterLength - 1) || handler.FilterDelay());
39 if (k != (kFilterLength - 1)) {
40 EXPECT_EQ(k, handler.FilterDelay());
41 }
42 }
43
44 // Verify that the externally reported delay is properly reported and
45 // converted.
46 handler.UpdateDelays(frequency_response, rtc::Optional<size_t>());
47 EXPECT_FALSE(handler.ExternalDelay());
48 for (int k = 0; k < kFilterLength - 1; ++k) {
49 handler.UpdateDelays(frequency_response,
50 rtc::Optional<size_t>(k * kBlockSize + 5));
51 EXPECT_TRUE(handler.ExternalDelay());
52 EXPECT_EQ(k, handler.ExternalDelay());
53 }
54
55 // Verify that the externally reported delay is properly unset when it is no
56 // longer present.
57 handler.UpdateDelays(frequency_response, rtc::Optional<size_t>());
58 EXPECT_FALSE(handler.ExternalDelay());
59 }
60
61 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698