OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (i % 100 == 0) { | 81 if (i % 100 == 0) { |
82 // This is causing the simulated clock drift. | 82 // This is causing the simulated clock drift. |
83 echo_detector.AnalyzeRenderAudio(zeros); | 83 echo_detector.AnalyzeRenderAudio(zeros); |
84 } | 84 } |
85 } | 85 } |
86 // We expect to detect echo with high likelihood. Clock drift is harder to | 86 // We expect to detect echo with high likelihood. Clock drift is harder to |
87 // correct on the render side than on the capture side. This is due to the | 87 // correct on the render side than on the capture side. This is due to the |
88 // render buffer, clock drift can only be discovered after a certain delay. | 88 // render buffer, clock drift can only be discovered after a certain delay. |
89 // A growing buffer can be caused by jitter or clock drift and it's not | 89 // A growing buffer can be caused by jitter or clock drift and it's not |
90 // possible to make this decision right away. For this reason we only expect | 90 // possible to make this decision right away. For this reason we only expect |
91 // an echo likelihood of 80% in this test. | 91 // an echo likelihood of 75% in this test. |
92 EXPECT_GT(echo_detector.echo_likelihood(), 0.8f); | 92 EXPECT_GT(echo_detector.echo_likelihood(), 0.75f); |
93 } | 93 } |
94 | 94 |
95 TEST(ResidualEchoDetectorTests, EchoWithCaptureClockDrift) { | 95 TEST(ResidualEchoDetectorTests, EchoWithCaptureClockDrift) { |
96 ResidualEchoDetector echo_detector; | 96 ResidualEchoDetector echo_detector; |
97 std::vector<float> ones(160, 1.f); | 97 std::vector<float> ones(160, 1.f); |
98 std::vector<float> zeros(160, 0.f); | 98 std::vector<float> zeros(160, 0.f); |
99 | 99 |
100 // In this test the capture signal has a delay of 10 frames w.r.t. the render | 100 // In this test the capture signal has a delay of 10 frames w.r.t. the render |
101 // signal, but is otherwise identical. Both signals are periodic with a 20 | 101 // signal, but is otherwise identical. Both signals are periodic with a 20 |
102 // frame interval. There is a simulated clock drift of 1% in this test, with | 102 // frame interval. There is a simulated clock drift of 1% in this test, with |
(...skipping 12 matching lines...) Expand all Loading... |
115 if (i % 100 == 0) { | 115 if (i % 100 == 0) { |
116 // This is causing the simulated clock drift. | 116 // This is causing the simulated clock drift. |
117 echo_detector.AnalyzeCaptureAudio(zeros); | 117 echo_detector.AnalyzeCaptureAudio(zeros); |
118 } | 118 } |
119 } | 119 } |
120 // We expect to detect echo with near certain likelihood. | 120 // We expect to detect echo with near certain likelihood. |
121 EXPECT_NEAR(1.f, echo_detector.echo_likelihood(), 0.01f); | 121 EXPECT_NEAR(1.f, echo_detector.echo_likelihood(), 0.01f); |
122 } | 122 } |
123 | 123 |
124 } // namespace webrtc | 124 } // namespace webrtc |
OLD | NEW |