| 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 namespace webrtc { |  18 namespace webrtc { | 
|  19 class CriticalSectionWrapper; |  19 class CriticalSectionWrapper; | 
|  20 class TimeScheduler |  20 class TimeScheduler { | 
|  21 { |  21  public: | 
|  22 public: |  22   TimeScheduler(const int64_t periodicityInMs); | 
|  23     TimeScheduler(const int64_t periodicityInMs); |  23   ~TimeScheduler(); | 
|  24     ~TimeScheduler(); |  | 
|  25  |  24  | 
|  26     // Signal that a periodic event has been triggered. |  25   // Signal that a periodic event has been triggered. | 
|  27     int32_t UpdateScheduler(); |  26   int32_t UpdateScheduler(); | 
|  28  |  27  | 
|  29     // Set updateTimeInMs to the amount of time until UpdateScheduler() should |  28   // Set updateTimeInMs to the amount of time until UpdateScheduler() should | 
|  30     // be called. This time will never be negative. |  29   // be called. This time will never be negative. | 
|  31     int32_t TimeToNextUpdate(int64_t& updateTimeInMS) const; |  30   int32_t TimeToNextUpdate(int64_t& updateTimeInMS) const; | 
|  32  |  31  | 
|  33 private: |  32  private: | 
|  34     CriticalSectionWrapper* _crit; |  33   CriticalSectionWrapper* _crit; | 
|  35  |  34  | 
|  36     bool _isStarted; |  35   bool _isStarted; | 
|  37     int64_t _lastPeriodMark; // In ns |  36   int64_t _lastPeriodMark;  // In ns | 
|  38  |  37  | 
|  39     int64_t _periodicityInMs; |  38   int64_t _periodicityInMs; | 
|  40     int64_t _periodicityInTicks; |  39   int64_t _periodicityInTicks; | 
|  41     uint32_t _missedPeriods; |  40   uint32_t _missedPeriods; | 
|  42 }; |  41 }; | 
|  43 }  // namespace webrtc |  42 }  // namespace webrtc | 
|  44  |  43  | 
|  45 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ |  44 #endif  // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_TIME_SCHEDULER_H_ | 
| OLD | NEW |