| Index: content/renderer/media/audio_device.h
|
| ===================================================================
|
| --- content/renderer/media/audio_device.h (revision 115436)
|
| +++ content/renderer/media/audio_device.h (working copy)
|
| @@ -73,25 +73,13 @@
|
| #include "content/common/content_export.h"
|
| #include "content/renderer/media/audio_message_filter.h"
|
| #include "media/audio/audio_parameters.h"
|
| +#include "media/base/audio_renderer_sink.h"
|
|
|
| class CONTENT_EXPORT AudioDevice
|
| - : public AudioMessageFilter::Delegate,
|
| - public base::DelegateSimpleThread::Delegate,
|
| - public base::RefCountedThreadSafe<AudioDevice> {
|
| + : public media::AudioRendererSink,
|
| + public AudioMessageFilter::Delegate,
|
| + public base::DelegateSimpleThread::Delegate {
|
| public:
|
| - class CONTENT_EXPORT RenderCallback {
|
| - public:
|
| - // Fills entire buffer of length |number_of_frames| but returns actual
|
| - // number of frames it got from its source (|number_of_frames| in case of
|
| - // continuous stream). That actual number of frames is passed to host
|
| - // together with PCM audio data and host is free to use or ignore it.
|
| - virtual size_t Render(const std::vector<float*>& audio_data,
|
| - size_t number_of_frames,
|
| - size_t audio_delay_milliseconds) = 0;
|
| - protected:
|
| - virtual ~RenderCallback() {}
|
| - };
|
| -
|
| // Methods called on main render thread -------------------------------------
|
|
|
| // Minimal constructor where Initialize() must be called later.
|
| @@ -103,38 +91,38 @@
|
| RenderCallback* callback);
|
| virtual ~AudioDevice();
|
|
|
| - void Initialize(size_t buffer_size,
|
| - int channels,
|
| - double sample_rate,
|
| - AudioParameters::Format latency_format,
|
| - RenderCallback* callback);
|
| - bool IsInitialized();
|
| + // AudioRendererSink implementation.
|
|
|
| + virtual void Initialize(size_t buffer_size,
|
| + int channels,
|
| + double sample_rate,
|
| + AudioParameters::Format latency_format,
|
| + RenderCallback* callback) OVERRIDE;
|
| // Starts audio playback.
|
| - void Start();
|
| + virtual void Start() OVERRIDE;
|
|
|
| // Stops audio playback.
|
| - void Stop();
|
| + virtual void Stop() OVERRIDE;
|
|
|
| // Resumes playback if currently paused.
|
| // TODO(crogers): it should be possible to remove the extra complexity
|
| // of Play() and Pause() with additional re-factoring work in
|
| // AudioRendererImpl.
|
| - void Play();
|
| + virtual void Play() OVERRIDE;
|
|
|
| // Pauses playback.
|
| // If |flush| is true then any pending audio that is in the pipeline
|
| // (has not yet reached the hardware) will be discarded. In this case,
|
| // when Play() is later called, no previous pending audio will be
|
| // rendered.
|
| - void Pause(bool flush);
|
| + virtual void Pause(bool flush) OVERRIDE;
|
|
|
| // Sets the playback volume, with range [0.0, 1.0] inclusive.
|
| // Returns |true| on success.
|
| - bool SetVolume(double volume);
|
| + virtual bool SetVolume(double volume) OVERRIDE;
|
|
|
| // Gets the playback volume, with range [0.0, 1.0] inclusive.
|
| - void GetVolume(double* volume);
|
| + virtual void GetVolume(double* volume) OVERRIDE;
|
|
|
| double sample_rate() const { return sample_rate_; }
|
| size_t buffer_size() const { return buffer_size_; }
|
|
|