OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ | 5 #ifndef MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ |
6 #define MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ | 6 #define MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 base::TimeDelta StartInterpolating(); | 35 base::TimeDelta StartInterpolating(); |
36 | 36 |
37 // Stops returning interpolated TimeDelta values. | 37 // Stops returning interpolated TimeDelta values. |
38 // | 38 // |
39 // |tick_clock| will be queried for a new reference time value. | 39 // |tick_clock| will be queried for a new reference time value. |
40 base::TimeDelta StopInterpolating(); | 40 base::TimeDelta StopInterpolating(); |
41 | 41 |
42 // Sets a new rate at which to interpolate. | 42 // Sets a new rate at which to interpolate. |
43 // | 43 // |
44 // |tick_clock| will be queried for a new reference time value. | 44 // |tick_clock| will be queried for a new reference time value. |
45 void SetPlaybackRate(float playback_rate); | 45 void SetPlaybackRate(double playback_rate); |
46 | 46 |
47 // Sets the two timestamps to interpolate between at |playback_rate_|. | 47 // Sets the two timestamps to interpolate between at |playback_rate_|. |
48 // |upper_bound| must be greater or equal to |lower_bound|. | 48 // |upper_bound| must be greater or equal to |lower_bound|. |
49 // | 49 // |
50 // |upper_bound| is typically the media timestamp of the last audio frame | 50 // |upper_bound| is typically the media timestamp of the last audio frame |
51 // buffered by the audio hardware. | 51 // buffered by the audio hardware. |
52 void SetBounds(base::TimeDelta lower_bound, base::TimeDelta upper_bound); | 52 void SetBounds(base::TimeDelta lower_bound, base::TimeDelta upper_bound); |
53 | 53 |
54 // Sets the upper bound used for interpolation. Note that if |upper_bound| is | 54 // Sets the upper bound used for interpolation. Note that if |upper_bound| is |
55 // less than what was previously set via SetTime(), then all future calls | 55 // less than what was previously set via SetTime(), then all future calls |
56 // to GetInterpolatedTime() will return |upper_bound|. | 56 // to GetInterpolatedTime() will return |upper_bound|. |
57 void SetUpperBound(base::TimeDelta upper_bound); | 57 void SetUpperBound(base::TimeDelta upper_bound); |
58 | 58 |
59 // Computes an interpolated time based on SetTime(). | 59 // Computes an interpolated time based on SetTime(). |
60 base::TimeDelta GetInterpolatedTime(); | 60 base::TimeDelta GetInterpolatedTime(); |
61 | 61 |
62 private: | 62 private: |
63 base::TickClock* const tick_clock_; | 63 base::TickClock* const tick_clock_; |
64 | 64 |
65 bool interpolating_; | 65 bool interpolating_; |
66 | 66 |
67 // The range of time to interpolate between. | 67 // The range of time to interpolate between. |
68 base::TimeDelta lower_bound_; | 68 base::TimeDelta lower_bound_; |
69 base::TimeDelta upper_bound_; | 69 base::TimeDelta upper_bound_; |
70 | 70 |
71 // The monotonic system clock time used for interpolating between | 71 // The monotonic system clock time used for interpolating between |
72 // |lower_bound_| and |upper_bound_|. | 72 // |lower_bound_| and |upper_bound_|. |
73 base::TimeTicks reference_; | 73 base::TimeTicks reference_; |
74 | 74 |
75 float playback_rate_; | 75 double playback_rate_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(TimeDeltaInterpolator); | 77 DISALLOW_COPY_AND_ASSIGN(TimeDeltaInterpolator); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace media | 80 } // namespace media |
81 | 81 |
82 #endif // MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ | 82 #endif // MEDIA_BASE_TIME_DELTA_INTERPOLATOR_H_ |
OLD | NEW |