| Index: media/audio/audio_manager_base.cc
|
| diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
|
| index 7fa476179b92601761ad599bc2cdd0d609fe8424..dfd6f8178e9313d5c50602dddb1d34e1eae7a62a 100644
|
| --- a/media/audio/audio_manager_base.cc
|
| +++ b/media/audio/audio_manager_base.cc
|
| @@ -3,12 +3,40 @@
|
| // found in the LICENSE file.
|
|
|
| #include "media/audio/audio_manager_base.h"
|
| +#include "media/audio/audio_output_proxy.h"
|
| +#include "media/audio/audio_output_dispatcher.h"
|
| +
|
| +// CompareAudioParams is needed for map to use AudioParameters as a key.
|
| +bool AudioManagerBase::CompareAudioParams::operator()(
|
| + const AudioParameters& a,
|
| + const AudioParameters& b) const {
|
| + if (a.format < b.format)
|
| + return true;
|
| + if (a.format > b.format)
|
| + return false;
|
| + if (a.channels < b.channels)
|
| + return true;
|
| + if (a.channels > b.channels)
|
| + return false;
|
| + if (a.sample_rate < b.sample_rate)
|
| + return true;
|
| + if (a.sample_rate > b.sample_rate)
|
| + return false;
|
| + if (a.bits_per_sample < b.bits_per_sample)
|
| + return true;
|
| + if (a.bits_per_sample > b.bits_per_sample)
|
| + return false;
|
| + return a.samples_per_packet > b.samples_per_packet;
|
| +}
|
|
|
| AudioManagerBase::AudioManagerBase()
|
| : audio_thread_("AudioThread"),
|
| initialized_(false) {
|
| }
|
|
|
| +AudioManagerBase::~AudioManagerBase() {
|
| +}
|
| +
|
| void AudioManagerBase::Init() {
|
| initialized_ = audio_thread_.Start();
|
| }
|
| @@ -17,3 +45,16 @@ MessageLoop* AudioManagerBase::GetMessageLoop() {
|
| DCHECK(initialized_);
|
| return audio_thread_.message_loop();
|
| }
|
| +
|
| +AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
|
| + AudioParameters params) {
|
| + if (!initialized_)
|
| + return NULL;
|
| +
|
| + scoped_refptr<AudioOutputDispatcher>& dispatcher =
|
| + output_dispatchers_[params];
|
| + if (!dispatcher)
|
| + dispatcher = new AudioOutputDispatcher(this, params);
|
| +
|
| + return new AudioOutputProxy(dispatcher);
|
| +}
|
|
|