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 |
11 #include "webrtc/test/drifting_clock.h" | 11 #include "webrtc/test/drifting_clock.h" |
12 #include "webrtc/base/checks.h" | 12 #include "webrtc/rtc_base/checks.h" |
13 | 13 |
14 namespace webrtc { | 14 namespace webrtc { |
15 namespace test { | 15 namespace test { |
16 const float DriftingClock::kDoubleSpeed = 2.0f; | 16 const float DriftingClock::kDoubleSpeed = 2.0f; |
17 const float DriftingClock::kNoDrift = 1.0f; | 17 const float DriftingClock::kNoDrift = 1.0f; |
18 const float DriftingClock::kHalfSpeed = 0.5f; | 18 const float DriftingClock::kHalfSpeed = 0.5f; |
19 | 19 |
20 DriftingClock::DriftingClock(Clock* clock, float speed) | 20 DriftingClock::DriftingClock(Clock* clock, float speed) |
21 : clock_(clock), | 21 : clock_(clock), |
22 drift_(speed - 1.0f), | 22 drift_(speed - 1.0f), |
(...skipping 24 matching lines...) Expand all Loading... |
47 uint64_t total_fractions = static_cast<uint64_t>(ntp); | 47 uint64_t total_fractions = static_cast<uint64_t>(ntp); |
48 total_fractions += Drift() * kNtpFracPerMicroSecond; | 48 total_fractions += Drift() * kNtpFracPerMicroSecond; |
49 return NtpTime(total_fractions); | 49 return NtpTime(total_fractions); |
50 } | 50 } |
51 | 51 |
52 int64_t DriftingClock::CurrentNtpInMilliseconds() const { | 52 int64_t DriftingClock::CurrentNtpInMilliseconds() const { |
53 return clock_->CurrentNtpInMilliseconds() + Drift() / 1000.; | 53 return clock_->CurrentNtpInMilliseconds() + Drift() / 1000.; |
54 } | 54 } |
55 } // namespace test | 55 } // namespace test |
56 } // namespace webrtc | 56 } // namespace webrtc |
OLD | NEW |