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

Unified Diff: media/filters/audio_renderer_impl.h

Issue 284763002: Update AudioRenderer API to fire changes in BufferingState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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
Index: media/filters/audio_renderer_impl.h
diff --git a/media/filters/audio_renderer_impl.h b/media/filters/audio_renderer_impl.h
index 7829366b3f8f7ea3e1a9cde74501705a5134c025..ba7bf0a9590226155751487833e63e2546b57462 100644
--- a/media/filters/audio_renderer_impl.h
+++ b/media/filters/audio_renderer_impl.h
@@ -68,8 +68,8 @@ class MEDIA_EXPORT AudioRendererImpl
virtual void Initialize(DemuxerStream* stream,
const PipelineStatusCB& init_cb,
const StatisticsCB& statistics_cb,
- const base::Closure& underflow_cb,
const TimeCB& time_cb,
+ const BufferingStateCB& buffering_state_cb,
const base::Closure& ended_cb,
const PipelineStatusCB& error_cb) OVERRIDE;
virtual void StartRendering() OVERRIDE;
@@ -77,9 +77,7 @@ class MEDIA_EXPORT AudioRendererImpl
virtual void Flush(const base::Closure& callback) OVERRIDE;
virtual void Stop(const base::Closure& callback) OVERRIDE;
virtual void SetPlaybackRate(float rate) OVERRIDE;
- virtual void Preroll(base::TimeDelta time,
- const PipelineStatusCB& cb) OVERRIDE;
- virtual void ResumeAfterUnderflow() OVERRIDE;
+ virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE;
virtual void SetVolume(float volume) OVERRIDE;
// Allows injection of a custom time callback for non-realtime testing.
@@ -104,25 +102,17 @@ class MEDIA_EXPORT AudioRendererImpl
// |
// V Decoders reset
// kFlushed <------------------ kFlushing
- // | Preroll() ^
+ // | StartPlayingFrom() ^
// | |
- // V | Flush()
- // kPrerolling ----------------> kPlaying ---------.
- // Enough data buffered ^ | Not enough data
- // | | buffered
- // Enough data buffered | V
- // kRebuffering <--- kUnderflow
- // ResumeAfterUnderflow()
+ // | | Flush()
+ // `---------> kPlaying --------'
enum State {
kUninitialized,
kInitializing,
kFlushing,
kFlushed,
- kPrerolling,
kPlaying,
kStopped,
- kUnderflow,
- kRebuffering,
};
// Callback from the audio decoder delivering decoded audio samples.
@@ -177,10 +167,9 @@ class MEDIA_EXPORT AudioRendererImpl
bool CanRead_Locked();
void ChangeState_Locked(State new_state);
- // Returns true if the data in the buffer is all before
- // |preroll_timestamp_|. This can only return true while
- // in the kPrerolling state.
- bool IsBeforePrerollTime(const scoped_refptr<AudioBuffer>& buffer);
+ // Returns true if the data in the buffer is all before |start_timestamp_|.
+ // This can only return true while in the kPlaying state.
+ bool IsBeforeStartTime(const scoped_refptr<AudioBuffer>& buffer);
// Called upon AudioBufferStream initialization, or failure thereof (indicated
// by the value of |success|).
@@ -226,17 +215,16 @@ class MEDIA_EXPORT AudioRendererImpl
// Callbacks provided during Initialize().
PipelineStatusCB init_cb_;
- base::Closure underflow_cb_;
TimeCB time_cb_;
+ BufferingStateCB buffering_state_cb_;
base::Closure ended_cb_;
PipelineStatusCB error_cb_;
+ BufferingState buffering_state_;
+
acolwell GONE FROM CHROMIUM 2014/05/16 17:25:08 This should go somewhere below the lock_ decl sinc
scherkus (not reviewing) 2014/05/22 17:49:12 Done.
// Callback provided to Flush().
base::Closure flush_cb_;
- // Callback provided to Preroll().
- PipelineStatusCB preroll_cb_;
-
// Typically calls base::TimeTicks::Now() but can be overridden by a test.
NowCB now_cb_;
@@ -264,7 +252,7 @@ class MEDIA_EXPORT AudioRendererImpl
scoped_ptr<AudioClock> audio_clock_;
- base::TimeDelta preroll_timestamp_;
+ base::TimeDelta start_timestamp_;
// We're supposed to know amount of audio data OS or hardware buffered, but
// that is not always so -- on my Linux box
@@ -283,10 +271,6 @@ class MEDIA_EXPORT AudioRendererImpl
base::TimeTicks earliest_end_time_;
size_t total_frames_filled_;
- // True if the renderer receives a buffer with kAborted status during preroll,
- // false otherwise. This flag is cleared on the next Preroll() call.
- bool preroll_aborted_;
-
// End variables which must be accessed under |lock_|. ----------------------
// NOTE: Weak pointers must be invalidated before all other member variables.

Powered by Google App Engine
This is Rietveld 408576698