diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 00:14:05 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-01 00:14:05 +0000 |
commit | b3354f22d6f6d778818347046fd1dad4d48f6974 (patch) | |
tree | 3e5135001307b0110fc5e4afceec74fe5d5ebf2d | |
parent | 8010517ee42b2d49c2b9f200a5e9319a9644534c (diff) | |
download | chromium_src-b3354f22d6f6d778818347046fd1dad4d48f6974.zip chromium_src-b3354f22d6f6d778818347046fd1dad4d48f6974.tar.gz chromium_src-b3354f22d6f6d778818347046fd1dad4d48f6974.tar.bz2 |
Reverting 19687.
Review URL: http://codereview.chromium.org/150145
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19689 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | media/filters/audio_renderer_algorithm_base.cc | 20 | ||||
-rw-r--r-- | media/filters/audio_renderer_algorithm_base.h | 32 | ||||
-rw-r--r-- | media/filters/audio_renderer_algorithm_default.cc | 3 | ||||
-rw-r--r-- | media/filters/audio_renderer_algorithm_default.h | 4 |
4 files changed, 30 insertions, 29 deletions
diff --git a/media/filters/audio_renderer_algorithm_base.cc b/media/filters/audio_renderer_algorithm_base.cc index 45887e7..f586c4a 100644 --- a/media/filters/audio_renderer_algorithm_base.cc +++ b/media/filters/audio_renderer_algorithm_base.cc @@ -4,8 +4,6 @@ #include "media/filters/audio_renderer_algorithm_base.h" -#include "media/base/buffers.h" - namespace media { // The maximum size of the queue, which also acts as the number of initial reads @@ -19,24 +17,26 @@ const size_t kDefaultMaxQueueSize = 16; AudioRendererAlgorithmBase::AudioRendererAlgorithmBase() : channels_(0), - sample_bytes_(0), + sample_rate_(0), + sample_bits_(0), playback_rate_(0.0f) { } AudioRendererAlgorithmBase::~AudioRendererAlgorithmBase() {} void AudioRendererAlgorithmBase::Initialize(int channels, + int sample_rate, int sample_bits, float initial_playback_rate, RequestReadCallback* callback) { DCHECK_GT(channels, 0); + DCHECK_GT(sample_rate, 0); DCHECK_GT(sample_bits, 0); DCHECK(callback); - // We only support 8, 16, 32 bit audio. - DCHECK_EQ(sample_bits % 8, 0) channels_ = channels; - sample_bytes_ = sample_bits / 8; + sample_rate_ = sample_rate; + sample_bits_ = sample_bits; request_read_callback_.reset(callback); set_playback_rate(initial_playback_rate); @@ -84,8 +84,12 @@ int AudioRendererAlgorithmBase::channels() { return channels_; } -int AudioRendererAlgorithmBase::sample_bytes() { - return sample_bytes_; +int AudioRendererAlgorithmBase::sample_rate() { + return sample_rate_; +} + +int AudioRendererAlgorithmBase::sample_bits() { + return sample_bits_; } } // namespace media diff --git a/media/filters/audio_renderer_algorithm_base.h b/media/filters/audio_renderer_algorithm_base.h index 7a370cb..47659a6 100644 --- a/media/filters/audio_renderer_algorithm_base.h +++ b/media/filters/audio_renderer_algorithm_base.h @@ -33,12 +33,11 @@ #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "base/task.h" +#include "media/base/data_buffer.h" +#include "media/base/buffers.h" namespace media { -class Buffer; -class DataBuffer; - class AudioRendererAlgorithmBase { public: // Used to simplify callback declarations. @@ -49,6 +48,7 @@ class AudioRendererAlgorithmBase { // Checks validity of audio parameters and takes ownership of |callback|. virtual void Initialize(int channels, + int sample_rate, int sample_bits, float initial_playback_rate, RequestReadCallback* callback); @@ -60,36 +60,36 @@ class AudioRendererAlgorithmBase { virtual size_t FillBuffer(DataBuffer* buffer_out) = 0; // Clears |queue_|. - virtual void FlushBuffers(); + void FlushBuffers(); // Enqueues a buffer. It is called from the owner // of the algorithm after a read completes. - virtual void EnqueueBuffer(Buffer* buffer_in); + void EnqueueBuffer(Buffer* buffer_in); // Getter/setter for |playback_rate_|. - virtual float playback_rate(); - virtual void set_playback_rate(float new_rate); + float playback_rate(); + void set_playback_rate(float new_rate); protected: // Returns whether |queue_| is empty. - virtual bool IsQueueEmpty(); + bool IsQueueEmpty(); // Returns a reference to the first element of the |queue_|. - virtual scoped_refptr<Buffer> FrontQueue(); + scoped_refptr<Buffer> FrontQueue(); // Pops the front of the |queue_| and schedules a read. - virtual void PopFrontQueue(); - - // Number of audio channels. - virtual int channels(); + void PopFrontQueue(); - // Number of bytes per sample per channel. - virtual int sample_bytes(); + // Audio property getters. + int channels(); + int sample_rate(); + int sample_bits(); private: // Audio properties. int channels_; - int sample_bytes_; + int sample_rate_; + int sample_bits_; // Used by algorithm to scale output. float playback_rate_; diff --git a/media/filters/audio_renderer_algorithm_default.cc b/media/filters/audio_renderer_algorithm_default.cc index 4184a98..74c0746 100644 --- a/media/filters/audio_renderer_algorithm_default.cc +++ b/media/filters/audio_renderer_algorithm_default.cc @@ -4,9 +4,6 @@ #include "media/filters/audio_renderer_algorithm_default.h" -#include "media/base/buffers.h" -#include "media/base/data_buffer.h" - namespace media { AudioRendererAlgorithmDefault::AudioRendererAlgorithmDefault() diff --git a/media/filters/audio_renderer_algorithm_default.h b/media/filters/audio_renderer_algorithm_default.h index 05c13e7..896f165 100644 --- a/media/filters/audio_renderer_algorithm_default.h +++ b/media/filters/audio_renderer_algorithm_default.h @@ -10,12 +10,12 @@ #ifndef MEDIA_FILTERS_AUDIO_RENDERER_ALGORITHM_DEFAULT_H_ #define MEDIA_FILTERS_AUDIO_RENDERER_ALGORITHM_DEFAULT_H_ +#include "base/time.h" +#include "media/base/data_buffer.h" #include "media/filters/audio_renderer_algorithm_base.h" namespace media { -class DataBuffer; - class AudioRendererAlgorithmDefault : public AudioRendererAlgorithmBase { public: AudioRendererAlgorithmDefault(); |