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

Unified Diff: media/base/audio_renderer.h

Issue 10753021: Move AudioRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: woot for RunInSeries/Parallel Created 8 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/base/callback_util.h » ('j') | media/base/callback_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_renderer.h
diff --git a/media/base/audio_renderer.h b/media/base/audio_renderer.h
index 0c9c5829be54f539d347bb95061bdb77383a6b05..8b4115b58f41ab556ecf8025442c52785629b8f5 100644
--- a/media/base/audio_renderer.h
+++ b/media/base/audio_renderer.h
@@ -16,37 +16,75 @@ namespace media {
class AudioDecoder;
-class MEDIA_EXPORT AudioRenderer : public Filter {
+class MEDIA_EXPORT AudioRenderer
+ : public base::RefCountedThreadSafe<AudioRenderer> {
public:
- // Used to update the pipeline's clock time. The first parameter is the
- // current time, and the second parameter is the time that the clock must not
- // exceed.
+ // First parameter is the current time that has been rendered.
+ // Second parameter is the maximum time value that the clock cannot exceed.
typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB;
// Initialize a AudioRenderer with the given AudioDecoder, executing the
- // |init_cb| upon completion. |underflow_cb| is called when the
- // renderer runs out of data to pass to the audio card during playback.
- // If the |underflow_cb| is called ResumeAfterUnderflow() must be called
+ // |init_cb| upon completion.
+ //
+ // |underflow_cb| is executed when the renderer runs out of data to pass to
+ // the audio card during playback. ResumeAfterUnderflow() must be called
// to resume playback. Pause(), Seek(), or Stop() cancels the underflow
// condition.
+ //
+ // |time_cb| is executed whenever time has advanced by way of audio rendering.
+ //
+ // |ended_cb| is executed when audio rendering has reached the end of stream.
+ //
+ // |disabled_cb| is executed when audio rendering has been disabled due to
+ // external factors (i.e., device was removed). |time_cb| will no longer be
+ // executed.
virtual void Initialize(const scoped_refptr<AudioDecoder>& decoder,
const PipelineStatusCB& init_cb,
const base::Closure& underflow_cb,
- const TimeCB& time_cb) = 0;
+ const TimeCB& time_cb,
+ const base::Closure& ended_cb,
acolwell GONE FROM CHROMIUM 2012/07/19 00:58:18 WDYT of moving this to Play() since it only makes
scherkus (not reviewing) 2012/07/19 21:29:02 I tried it out but the only difference seemed to b
+ const base::Closure& disabled_cb) = 0;
- // Returns true if this filter has received and processed an end-of-stream
- // buffer.
+ // Start audio decoding and rendering at the current playback rate, executing
+ // |callback| when playback is underway.
+ virtual void Play(const base::Closure& callback) = 0;
+
+ // Temporarily suspend decoding and rendering audio, executing |callback| when
+ // playback has been suspended.
+ virtual void Pause(const base::Closure& callback) = 0;
+
+ // Discard any audio data, executing |callback| when completed.
+ virtual void Flush(const base::Closure& callback) = 0;
+
+ // Start prerolling audio data for samples starting at |time|, executing
+ // |callback| when completed.
+ //
+ // Only valid to call after a successful Initialize() or Flush().
+ //
+ // TODO(scherkus): rename this to Preroll().
+ virtual void Seek(base::TimeDelta time, const PipelineStatusCB& callback) = 0;
+
+ // Stop all operations in preparation for being deleted, executing |callback|
+ // when complete.
+ virtual void Stop(const base::Closure& callback) = 0;
+
+ // Updates the current playback rate.
+ virtual void SetPlaybackRate(float playback_rate) = 0;
+
+ // Returns true if all audio data has been played back by the audio device.
virtual bool HasEnded() = 0;
// Sets the output volume.
virtual void SetVolume(float volume) = 0;
// Resumes playback after underflow occurs.
+ //
// |buffer_more_audio| is set to true if you want to increase the size of the
// decoded audio buffer.
virtual void ResumeAfterUnderflow(bool buffer_more_audio) = 0;
protected:
+ friend class base::RefCountedThreadSafe<AudioRenderer>;
virtual ~AudioRenderer() {}
};
« no previous file with comments | « no previous file | media/base/callback_util.h » ('j') | media/base/callback_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698