OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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/base/timeutils.h" |
11 #include "webrtc/modules/audio_conference_mixer/source/time_scheduler.h" | 12 #include "webrtc/modules/audio_conference_mixer/source/time_scheduler.h" |
12 #include "webrtc/rtc_base/timeutils.h" | |
13 | 13 |
14 namespace webrtc { | 14 namespace webrtc { |
15 TimeScheduler::TimeScheduler(const int64_t periodicityInMs) | 15 TimeScheduler::TimeScheduler(const int64_t periodicityInMs) |
16 : _isStarted(false), | 16 : _isStarted(false), |
17 _lastPeriodMark(), | 17 _lastPeriodMark(), |
18 _periodicityInMs(periodicityInMs), | 18 _periodicityInMs(periodicityInMs), |
19 _periodicityInTicks(periodicityInMs * rtc::kNumNanosecsPerMillisec), | 19 _periodicityInTicks(periodicityInMs * rtc::kNumNanosecsPerMillisec), |
20 _missedPeriods(0) {} | 20 _missedPeriods(0) {} |
21 | 21 |
22 int32_t TimeScheduler::UpdateScheduler() { | 22 int32_t TimeScheduler::UpdateScheduler() { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 int64_t tickNow = rtc::TimeNanos(); | 83 int64_t tickNow = rtc::TimeNanos(); |
84 int64_t ticksSinceLastUpdate = tickNow - _lastPeriodMark; | 84 int64_t ticksSinceLastUpdate = tickNow - _lastPeriodMark; |
85 const int64_t millisecondsSinceLastUpdate = | 85 const int64_t millisecondsSinceLastUpdate = |
86 ticksSinceLastUpdate / rtc::kNumNanosecsPerMillisec; | 86 ticksSinceLastUpdate / rtc::kNumNanosecsPerMillisec; |
87 | 87 |
88 updateTimeInMS = _periodicityInMs - millisecondsSinceLastUpdate; | 88 updateTimeInMS = _periodicityInMs - millisecondsSinceLastUpdate; |
89 updateTimeInMS = (updateTimeInMS < 0) ? 0 : updateTimeInMS; | 89 updateTimeInMS = (updateTimeInMS < 0) ? 0 : updateTimeInMS; |
90 return 0; | 90 return 0; |
91 } | 91 } |
92 } // namespace webrtc | 92 } // namespace webrtc |
OLD | NEW |