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 // The TimeScheduler class keeps track of periodic events. It is non-drifting | 11 // The TimeScheduler class keeps track of periodic events. It is non-drifting |
12 // and keeps track of any missed periods so that it is possible to catch up. | 12 // and keeps track of any missed periods so that it is possible to catch up. |
13 // (compare to a metronome) | 13 // (compare to a metronome) |
14 | 14 |
15 #ifndef WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ | 15 #ifndef WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ |
16 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ | 16 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ |
17 | 17 |
18 #include "webrtc/system_wrappers/interface/tick_util.h" | 18 #include "webrtc/system_wrappers/include/tick_util.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 class CriticalSectionWrapper; | 21 class CriticalSectionWrapper; |
22 class TimeScheduler | 22 class TimeScheduler |
23 { | 23 { |
24 public: | 24 public: |
25 TimeScheduler(const int64_t periodicityInMs); | 25 TimeScheduler(const int64_t periodicityInMs); |
26 ~TimeScheduler(); | 26 ~TimeScheduler(); |
27 | 27 |
28 // Signal that a periodic event has been triggered. | 28 // Signal that a periodic event has been triggered. |
29 int32_t UpdateScheduler(); | 29 int32_t UpdateScheduler(); |
30 | 30 |
31 // Set updateTimeInMs to the amount of time until UpdateScheduler() should | 31 // Set updateTimeInMs to the amount of time until UpdateScheduler() should |
32 // be called. This time will never be negative. | 32 // be called. This time will never be negative. |
33 int32_t TimeToNextUpdate(int64_t& updateTimeInMS) const; | 33 int32_t TimeToNextUpdate(int64_t& updateTimeInMS) const; |
34 | 34 |
35 private: | 35 private: |
36 CriticalSectionWrapper* _crit; | 36 CriticalSectionWrapper* _crit; |
37 | 37 |
38 bool _isStarted; | 38 bool _isStarted; |
39 TickTime _lastPeriodMark; | 39 TickTime _lastPeriodMark; |
40 | 40 |
41 int64_t _periodicityInMs; | 41 int64_t _periodicityInMs; |
42 int64_t _periodicityInTicks; | 42 int64_t _periodicityInTicks; |
43 uint32_t _missedPeriods; | 43 uint32_t _missedPeriods; |
44 }; | 44 }; |
45 } // namespace webrtc | 45 } // namespace webrtc |
46 | 46 |
47 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ | 47 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ |
OLD | NEW |