summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorkylep@chromium.org <kylep@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 00:04:51 +0000
committerkylep@chromium.org <kylep@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 00:04:51 +0000
commit8010517ee42b2d49c2b9f200a5e9319a9644534c (patch)
treecee52db11f66c1b43f8d9f02eb783a2bf0519de4 /media
parent3ca29e2d2844eef858a635a32e34e298ceea0b10 (diff)
downloadchromium_src-8010517ee42b2d49c2b9f200a5e9319a9644534c.zip
chromium_src-8010517ee42b2d49c2b9f200a5e9319a9644534c.tar.gz
chromium_src-8010517ee42b2d49c2b9f200a5e9319a9644534c.tar.bz2
Minor changes to ARAB and ARAD necessary for OLA
Review URL: http://codereview.chromium.org/150140 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19687 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/filters/audio_renderer_algorithm_base.cc20
-rw-r--r--media/filters/audio_renderer_algorithm_base.h32
-rw-r--r--media/filters/audio_renderer_algorithm_default.cc3
-rw-r--r--media/filters/audio_renderer_algorithm_default.h4
4 files changed, 29 insertions, 30 deletions
diff --git a/media/filters/audio_renderer_algorithm_base.cc b/media/filters/audio_renderer_algorithm_base.cc
index f586c4a..45887e7 100644
--- a/media/filters/audio_renderer_algorithm_base.cc
+++ b/media/filters/audio_renderer_algorithm_base.cc
@@ -4,6 +4,8 @@
#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
@@ -17,26 +19,24 @@ const size_t kDefaultMaxQueueSize = 16;
AudioRendererAlgorithmBase::AudioRendererAlgorithmBase()
: channels_(0),
- sample_rate_(0),
- sample_bits_(0),
+ sample_bytes_(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_rate_ = sample_rate;
- sample_bits_ = sample_bits;
+ sample_bytes_ = sample_bits / 8;
request_read_callback_.reset(callback);
set_playback_rate(initial_playback_rate);
@@ -84,12 +84,8 @@ int AudioRendererAlgorithmBase::channels() {
return channels_;
}
-int AudioRendererAlgorithmBase::sample_rate() {
- return sample_rate_;
-}
-
-int AudioRendererAlgorithmBase::sample_bits() {
- return sample_bits_;
+int AudioRendererAlgorithmBase::sample_bytes() {
+ return sample_bytes_;
}
} // namespace media
diff --git a/media/filters/audio_renderer_algorithm_base.h b/media/filters/audio_renderer_algorithm_base.h
index 47659a6..7a370cb 100644
--- a/media/filters/audio_renderer_algorithm_base.h
+++ b/media/filters/audio_renderer_algorithm_base.h
@@ -33,11 +33,12 @@
#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.
@@ -48,7 +49,6 @@ 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_|.
- void FlushBuffers();
+ virtual void FlushBuffers();
// Enqueues a buffer. It is called from the owner
// of the algorithm after a read completes.
- void EnqueueBuffer(Buffer* buffer_in);
+ virtual void EnqueueBuffer(Buffer* buffer_in);
// Getter/setter for |playback_rate_|.
- float playback_rate();
- void set_playback_rate(float new_rate);
+ virtual float playback_rate();
+ virtual void set_playback_rate(float new_rate);
protected:
// Returns whether |queue_| is empty.
- bool IsQueueEmpty();
+ virtual bool IsQueueEmpty();
// Returns a reference to the first element of the |queue_|.
- scoped_refptr<Buffer> FrontQueue();
+ virtual scoped_refptr<Buffer> FrontQueue();
// Pops the front of the |queue_| and schedules a read.
- void PopFrontQueue();
+ virtual void PopFrontQueue();
+
+ // Number of audio channels.
+ virtual int channels();
- // Audio property getters.
- int channels();
- int sample_rate();
- int sample_bits();
+ // Number of bytes per sample per channel.
+ virtual int sample_bytes();
private:
// Audio properties.
int channels_;
- int sample_rate_;
- int sample_bits_;
+ int sample_bytes_;
// 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 74c0746..4184a98 100644
--- a/media/filters/audio_renderer_algorithm_default.cc
+++ b/media/filters/audio_renderer_algorithm_default.cc
@@ -4,6 +4,9 @@
#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 896f165..05c13e7 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();