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

Unified Diff: media/filters/audio_renderer_impl.h

Issue 384543002: Move bulk of media::AudioRendererImpl::Render() logic to media thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use time_since_writing Created 6 years, 5 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_renderer_impl.cc » ('j') | media/filters/audio_renderer_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_|. ------------------------------------------------------------
« no previous file with comments | « no previous file | media/filters/audio_renderer_impl.cc » ('j') | media/filters/audio_renderer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698