Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1615)

Unified Diff: media/filters/audio_clock.h

Issue 518613002: Have AudioRendererImpl advance time until it's told to stop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename to front/back Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/filters/audio_clock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_clock.h
diff --git a/media/filters/audio_clock.h b/media/filters/audio_clock.h
index 1a27dee00092dea9134950f7ba5b97c83c6951b5..a823a825e107e292dd3a21ad5d5f26443fdde311 100644
--- a/media/filters/audio_clock.h
+++ b/media/filters/audio_clock.h
@@ -29,15 +29,27 @@ class MEDIA_EXPORT AudioClock {
int delay_frames,
float playback_rate);
- // Calculates the current media timestamp taking silence and changes in
- // playback rate into account.
- base::TimeDelta current_media_timestamp() const {
- return current_media_timestamp_;
- }
+ // Returns the bounds of media data currently buffered by the audio hardware,
+ // taking silence and changes in playback rate into account.
+ //
DaleCurtis 2014/09/03 22:00:45 Can you add the WroteAudio() calls that generated
scherkus (not reviewing) 2014/09/03 22:23:18 Done.
+ // start_timestamp = 1000 ms sample_rate = 40 Hz
+ // +-----------------------+----------------------+-----------------------+
+ // | 10 frames silence | 20 frames @ 1.0x | 20 frames @ 0.5x |
+ // | | = 500 ms | = 250 ms |
+ // +-----------------------+----------------------+-----------------------+
+ // ^ ^
+ // front_timestamp() is equal to back_timestamp() is equal to
+ // |start_timestamp| since no amount of media frames tracked
+ // media data has been played yet. by AudioClock, which would be
+ // 1750 ms.
+ base::TimeDelta front_timestamp() const { return front_timestamp_; }
+ base::TimeDelta back_timestamp() const { return back_timestamp_; }
// Clients can provide |time_since_writing| to simulate the passage of time
// since last writing audio to get a more accurate current media timestamp.
- base::TimeDelta CurrentMediaTimestampSinceWriting(
+ //
+ // The value will be bounded between front_timestamp() and back_timestamp().
+ base::TimeDelta TimestampSinceWriting(
base::TimeDelta time_since_writing) const;
// Returns the amount of contiguous media time buffered at the head of the
@@ -53,10 +65,6 @@ class MEDIA_EXPORT AudioClock {
return contiguous_audio_data_buffered_at_same_rate_;
}
- // Returns true if there is any audio data buffered by the audio hardware,
- // even if there is silence mixed in.
- bool audio_data_buffered() const { return audio_data_buffered_; }
-
private:
// Even with a ridiculously high sample rate of 256kHz, using 64 bits will
// permit tracking up to 416999965 days worth of time (that's 1141 millenia).
@@ -81,10 +89,10 @@ class MEDIA_EXPORT AudioClock {
std::deque<AudioData> buffered_;
int64_t total_buffered_frames_;
- base::TimeDelta current_media_timestamp_;
+ base::TimeDelta front_timestamp_;
+ base::TimeDelta back_timestamp_;
// Cached results of last call to WroteAudio().
- bool audio_data_buffered_;
base::TimeDelta contiguous_audio_data_buffered_;
base::TimeDelta contiguous_audio_data_buffered_at_same_rate_;
« no previous file with comments | « no previous file | media/filters/audio_clock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698