Chromium Code Reviews| 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_FILTERS_AUDIO_CLOCK_H_ | 5 #ifndef MEDIA_FILTERS_AUDIO_CLOCK_H_ |
| 6 #define MEDIA_FILTERS_AUDIO_CLOCK_H_ | 6 #define MEDIA_FILTERS_AUDIO_CLOCK_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 base::TimeDelta front_timestamp() const { return front_timestamp_; } | 77 base::TimeDelta front_timestamp() const { return front_timestamp_; } |
| 78 base::TimeDelta back_timestamp() const { return back_timestamp_; } | 78 base::TimeDelta back_timestamp() const { return back_timestamp_; } |
| 79 | 79 |
| 80 // Clients can provide |time_since_writing| to simulate the passage of time | 80 // Clients can provide |time_since_writing| to simulate the passage of time |
| 81 // since last writing audio to get a more accurate current media timestamp. | 81 // since last writing audio to get a more accurate current media timestamp. |
| 82 // | 82 // |
| 83 // The value will be bounded between front_timestamp() and back_timestamp(). | 83 // The value will be bounded between front_timestamp() and back_timestamp(). |
| 84 base::TimeDelta TimestampSinceWriting( | 84 base::TimeDelta TimestampSinceWriting( |
| 85 base::TimeDelta time_since_writing) const; | 85 base::TimeDelta time_since_writing) const; |
| 86 | 86 |
| 87 // Returns the amount of wall time until |timestamp| will be played by the | |
| 88 // audio hardware. | |
| 89 // | |
| 90 // |timestamp| must be within front_timestamp() and back_timestamp(). | |
| 91 base::TimeDelta WallTimeForTimestamp(base::TimeDelta timestamp) const; | |
|
DaleCurtis
2014/09/20 00:17:12
What do you think about TimeToPlayback(), TimeUnti
scherkus (not reviewing)
2014/09/22 18:34:12
picked TimeUntilPlayback()
| |
| 92 | |
| 87 // Returns the amount of contiguous media time buffered at the head of the | 93 // Returns the amount of contiguous media time buffered at the head of the |
| 88 // audio hardware buffer. Silence introduced into the audio hardware buffer is | 94 // audio hardware buffer. Silence introduced into the audio hardware buffer is |
| 89 // treated as a break in media time. | 95 // treated as a break in media time. |
| 90 base::TimeDelta contiguous_audio_data_buffered() const { | 96 base::TimeDelta contiguous_audio_data_buffered() const { |
| 91 return contiguous_audio_data_buffered_; | 97 return contiguous_audio_data_buffered_; |
| 92 } | 98 } |
| 93 | 99 |
| 94 // Same as above, but also treats changes in playback rate as a break in media | 100 // Same as above, but also treats changes in playback rate as a break in media |
| 95 // time. | 101 // time. |
| 96 base::TimeDelta contiguous_audio_data_buffered_at_same_rate() const { | 102 base::TimeDelta contiguous_audio_data_buffered_at_same_rate() const { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 127 // Cached results of last call to WroteAudio(). | 133 // Cached results of last call to WroteAudio(). |
| 128 base::TimeDelta contiguous_audio_data_buffered_; | 134 base::TimeDelta contiguous_audio_data_buffered_; |
| 129 base::TimeDelta contiguous_audio_data_buffered_at_same_rate_; | 135 base::TimeDelta contiguous_audio_data_buffered_at_same_rate_; |
| 130 | 136 |
| 131 DISALLOW_COPY_AND_ASSIGN(AudioClock); | 137 DISALLOW_COPY_AND_ASSIGN(AudioClock); |
| 132 }; | 138 }; |
| 133 | 139 |
| 134 } // namespace media | 140 } // namespace media |
| 135 | 141 |
| 136 #endif // MEDIA_FILTERS_AUDIO_CLOCK_H_ | 142 #endif // MEDIA_FILTERS_AUDIO_CLOCK_H_ |
| OLD | NEW |