OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 // Unit tests for BufferLevelFilter class. | 11 // Unit tests for BufferLevelFilter class. |
12 | 12 |
13 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h" | 13 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h" |
14 | 14 |
15 #include <math.h> // Access to pow function. | 15 #include <math.h> // Access to pow function. |
16 | 16 |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "webrtc/test/gtest.h" |
18 | 18 |
19 namespace webrtc { | 19 namespace webrtc { |
20 | 20 |
21 TEST(BufferLevelFilter, CreateAndDestroy) { | 21 TEST(BufferLevelFilter, CreateAndDestroy) { |
22 BufferLevelFilter* filter = new BufferLevelFilter(); | 22 BufferLevelFilter* filter = new BufferLevelFilter(); |
23 EXPECT_EQ(0, filter->filtered_current_level()); | 23 EXPECT_EQ(0, filter->filtered_current_level()); |
24 delete filter; | 24 delete filter; |
25 } | 25 } |
26 | 26 |
27 TEST(BufferLevelFilter, ConvergenceTest) { | 27 TEST(BufferLevelFilter, ConvergenceTest) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 filter.Update(filter.filtered_current_level() >> 8, kTimeStretchedSamples, | 153 filter.Update(filter.filtered_current_level() >> 8, kTimeStretchedSamples, |
154 kPacketSizeSamples); | 154 kPacketSizeSamples); |
155 EXPECT_EQ(21, filter.filtered_current_level() >> 8); | 155 EXPECT_EQ(21, filter.filtered_current_level() >> 8); |
156 // Try negative value and verify that we come back to the previous result. | 156 // Try negative value and verify that we come back to the previous result. |
157 filter.Update(filter.filtered_current_level() >> 8, -kTimeStretchedSamples, | 157 filter.Update(filter.filtered_current_level() >> 8, -kTimeStretchedSamples, |
158 kPacketSizeSamples); | 158 kPacketSizeSamples); |
159 EXPECT_EQ(kExpectedValue, filter.filtered_current_level() >> 8); | 159 EXPECT_EQ(kExpectedValue, filter.filtered_current_level() >> 8); |
160 } | 160 } |
161 | 161 |
162 } // namespace webrtc | 162 } // namespace webrtc |
OLD | NEW |