| Index: media/base/audio_bus.cc
|
| ===================================================================
|
| --- media/base/audio_bus.cc (revision 156450)
|
| +++ media/base/audio_bus.cc (working copy)
|
| @@ -10,6 +10,10 @@
|
| #include "media/audio/audio_parameters.h"
|
| #include "media/base/limits.h"
|
|
|
| +#if defined(OS_MACOSX)
|
| +#include <CoreAudio/CoreAudioTypes.h>
|
| +#endif
|
| +
|
| namespace media {
|
|
|
| static bool IsAligned(void* ptr) {
|
| @@ -137,6 +141,28 @@
|
| DCHECK(IsAligned(channel_data_[i]));
|
| }
|
|
|
| +#if defined(OS_MACOSX)
|
| +AudioBus::AudioBus(int channels, int frames, AudioBufferList* buffer_list)
|
| + : frames_(frames) {
|
| + ValidateConfig(channels, frames_);
|
| +
|
| + channel_data_.reserve(channels);
|
| +
|
| + // Copy pointers from AudioBufferList.
|
| + // It's ok to pass in a |buffer_list| with fewer channels, in which
|
| + // case we just duplicate the last channel.
|
| + int source_idx = 0;
|
| + for (int i = 0; i < channels; ++i) {
|
| + channel_data_.push_back(
|
| + static_cast<float*>(buffer_list->mBuffers[source_idx].mData));
|
| + DCHECK(IsAligned(channel_data_[i]));
|
| +
|
| + if (source_idx < channels - 1)
|
| + ++source_idx;
|
| + }
|
| +}
|
| +#endif
|
| +
|
| AudioBus::~AudioBus() {}
|
|
|
| scoped_ptr<AudioBus> AudioBus::Create(int channels, int frames) {
|
|
|