| Index: media/filters/audio_renderer_impl.h
|
| diff --git a/media/filters/audio_renderer_impl.h b/media/filters/audio_renderer_impl.h
|
| index 2e29a9e82110adce8bccd546adcb3992a1323247..7871924d922913c9c5786ae7301a760b715c2e6f 100644
|
| --- a/media/filters/audio_renderer_impl.h
|
| +++ b/media/filters/audio_renderer_impl.h
|
| @@ -33,6 +33,7 @@
|
|
|
| namespace base {
|
| class SingleThreadTaskRunner;
|
| +class TickClock;
|
| }
|
|
|
| namespace media {
|
| @@ -80,11 +81,7 @@ class MEDIA_EXPORT AudioRendererImpl
|
| virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE;
|
| virtual void SetVolume(float volume) OVERRIDE;
|
|
|
| - // 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) {
|
| - now_cb_ = now_cb;
|
| - }
|
| + void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock);
|
|
|
| private:
|
| friend class AudioRendererImplTest;
|
| @@ -153,13 +150,25 @@ class MEDIA_EXPORT AudioRendererImpl
|
| int audio_delay_milliseconds) OVERRIDE;
|
| virtual void OnRenderError() OVERRIDE;
|
|
|
| + // Contains result of the last call to Render(). Used to update |audio_clock_|
|
| + // and changes in buffering state.
|
| + struct RenderResult {
|
| + RenderResult();
|
| +
|
| + base::TimeTicks ticks;
|
| + int requested_frames;
|
| + int delay_frames;
|
| + int frames_written;
|
| + float playback_rate;
|
| + base::TimeDelta endpoint_timestamp;
|
| + };
|
| + void DidRender(RenderResult result);
|
| +
|
| // Helper methods that schedule an asynchronous read from the decoder as long
|
| // as there isn't a pending read.
|
| //
|
| // Must be called on |task_runner_|.
|
| - void AttemptRead();
|
| void AttemptRead_Locked();
|
| - bool CanRead_Locked();
|
| void ChangeState_Locked(State new_state);
|
|
|
| // Returns true if the data in the buffer is all before |start_timestamp_|.
|
| @@ -188,7 +197,7 @@ class MEDIA_EXPORT AudioRendererImpl
|
| void OnConfigChange();
|
|
|
| // Updates |buffering_state_| and fires |buffering_state_cb_|.
|
| - void SetBufferingState_Locked(BufferingState buffering_state);
|
| + void SetBufferingState(BufferingState buffering_state);
|
|
|
| scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
|
|
| @@ -221,8 +230,7 @@ class MEDIA_EXPORT AudioRendererImpl
|
| // Callback provided to Flush().
|
| base::Closure flush_cb_;
|
|
|
| - // Typically calls base::TimeTicks::Now() but can be overridden by a test.
|
| - NowCB now_cb_;
|
| + scoped_ptr<base::TickClock> tick_clock_;
|
|
|
| // After Initialize() has completed, all variables below must be accessed
|
| // under |lock_|. ------------------------------------------------------------
|
|
|