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 17 matching lines...) Expand all Loading... | |
28 int delay_frames, | 28 int delay_frames, |
29 float playback_rate, | 29 float playback_rate, |
30 base::TimeDelta timestamp); | 30 base::TimeDelta timestamp); |
31 | 31 |
32 // |frames| amount of silence was written. | 32 // |frames| amount of silence was written. |
33 // |delay_frames| is the current amount of hardware delay. | 33 // |delay_frames| is the current amount of hardware delay. |
34 void WroteSilence(int frames, int delay_frames); | 34 void WroteSilence(int frames, int delay_frames); |
35 | 35 |
36 // Calculates the current media timestamp taking silence and changes in | 36 // Calculates the current media timestamp taking silence and changes in |
37 // playback rate into account. | 37 // playback rate into account. |
38 base::TimeDelta CurrentMediaTimestamp() const; | 38 // |
39 // Clients can provide |time_since_writing| to simulate the passage of time | |
DaleCurtis
2014/07/15 18:13:15
Hmm, I don't quite understand how you're going to
| |
40 // since last writing audio to get a more accurate current media timestamp. | |
41 base::TimeDelta CurrentMediaTimestamp( | |
42 base::TimeDelta time_since_writing) const; | |
39 | 43 |
40 // Returns the last endpoint timestamp provided to WroteAudio(). | 44 // Returns the last endpoint timestamp provided to WroteAudio(). |
41 base::TimeDelta last_endpoint_timestamp() const { | 45 base::TimeDelta last_endpoint_timestamp() const { |
42 return last_endpoint_timestamp_; | 46 return last_endpoint_timestamp_; |
43 } | 47 } |
44 | 48 |
45 private: | 49 private: |
46 void TrimBufferedAudioToMatchDelay(int delay_frames); | 50 void TrimBufferedAudioToMatchDelay(int delay_frames); |
47 void PushBufferedAudio(int frames, | 51 void PushBufferedAudio(int frames, |
48 float playback_rate, | 52 float playback_rate, |
(...skipping 18 matching lines...) Expand all Loading... | |
67 }; | 71 }; |
68 | 72 |
69 std::deque<BufferedAudio> buffered_audio_; | 73 std::deque<BufferedAudio> buffered_audio_; |
70 | 74 |
71 DISALLOW_COPY_AND_ASSIGN(AudioClock); | 75 DISALLOW_COPY_AND_ASSIGN(AudioClock); |
72 }; | 76 }; |
73 | 77 |
74 } // namespace media | 78 } // namespace media |
75 | 79 |
76 #endif // MEDIA_FILTERS_AUDIO_CLOCK_H_ | 80 #endif // MEDIA_FILTERS_AUDIO_CLOCK_H_ |
OLD | NEW |