OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 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 |
11 #include <math.h> | 11 #include <math.h> |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 #include <limits> | 14 #include <limits> |
15 | 15 |
16 #include "webrtc/base/gunit.h" | 16 #include "webrtc/rtc_base/gunit.h" |
17 #include "webrtc/base/random.h" | 17 #include "webrtc/rtc_base/random.h" |
18 #include "webrtc/base/timestampaligner.h" | 18 #include "webrtc/rtc_base/timestampaligner.h" |
19 | 19 |
20 namespace rtc { | 20 namespace rtc { |
21 | 21 |
22 namespace { | 22 namespace { |
23 // Computes the difference x_k - mean(x), when x_k is the linear sequence x_k = | 23 // Computes the difference x_k - mean(x), when x_k is the linear sequence x_k = |
24 // k, and the "mean" is plain mean for the first |window_size| samples, followed | 24 // k, and the "mean" is plain mean for the first |window_size| samples, followed |
25 // by exponential averaging with weight 1 / |window_size| for each new sample. | 25 // by exponential averaging with weight 1 / |window_size| for each new sample. |
26 // This is needed to predict the effect of camera clock drift on the timestamp | 26 // This is needed to predict the effect of camera clock drift on the timestamp |
27 // translation. See the comment on TimestampAligner::UpdateOffset for more | 27 // translation. See the comment on TimestampAligner::UpdateOffset for more |
28 // context. | 28 // context. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } else { | 178 } else { |
179 // No change from clipping. | 179 // No change from clipping. |
180 EXPECT_EQ(clip_timestamp_us, translated_timestamp_us); | 180 EXPECT_EQ(clip_timestamp_us, translated_timestamp_us); |
181 } | 181 } |
182 prev_timestamp_us = clip_timestamp_us; | 182 prev_timestamp_us = clip_timestamp_us; |
183 } | 183 } |
184 EXPECT_TRUE(did_clip); | 184 EXPECT_TRUE(did_clip); |
185 } | 185 } |
186 | 186 |
187 } // namespace rtc | 187 } // namespace rtc |
OLD | NEW |