Chromium Code Reviews| Index: media/filters/audio_renderer_impl.h |
| diff --git a/media/filters/audio_renderer_impl.h b/media/filters/audio_renderer_impl.h |
| index c98ead8d0c18007c90823d060a1cfa2bc15938e3..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,17 +77,9 @@ 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; |
| - // Disables underflow support. When used, |state_| will never transition to |
| - // kUnderflow resulting in Render calls that underflow returning 0 frames |
| - // instead of some number of silence frames. Must be called prior to |
| - // Initialize(). |
| - void DisableUnderflowForTesting(); |
| - |
| // Allows injection of a custom time callback for non-realtime testing. |
| typedef base::Callback<base::TimeTicks()> NowCB; |
| void set_now_cb_for_testing(const NowCB& now_cb) { |
| @@ -110,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 --------' |
|
acolwell GONE FROM CHROMIUM
2014/05/13 20:44:27
\o/ so much nicer
|
| enum State { |
| kUninitialized, |
| kInitializing, |
| kFlushing, |
| kFlushed, |
| - kPrerolling, |
| kPlaying, |
| kStopped, |
| - kUnderflow, |
| - kRebuffering, |
| }; |
| // Callback from the audio decoder delivering decoded audio samples. |
| @@ -183,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|). |
| @@ -232,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_; |
| + |
| // 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_; |
| @@ -270,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 |
| @@ -289,12 +271,6 @@ class MEDIA_EXPORT AudioRendererImpl |
| base::TimeTicks earliest_end_time_; |
| size_t total_frames_filled_; |
| - bool underflow_disabled_; |
| - |
| - // 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. |