Index: media/base/audio_bus.cc |
=================================================================== |
--- media/base/audio_bus.cc (revision 156920) |
+++ 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) |
no longer working on chromium
2012/09/17 20:47:46
move this above #include <limits>
|
+#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) { |
no longer working on chromium
2012/09/17 20:47:46
we should be able to use only either source_idx or
|
+ channel_data_.push_back( |
+ static_cast<float*>(buffer_list->mBuffers[source_idx].mData)); |
scherkus (not reviewing)
2012/09/17 14:51:17
it does seem that we could have this bit of code a
|
+ DCHECK(IsAligned(channel_data_[i])); |
+ |
+ if (source_idx < channels - 1) |
+ ++source_idx; |
+ } |
+} |
+#endif |
+ |
AudioBus::~AudioBus() {} |
scoped_ptr<AudioBus> AudioBus::Create(int channels, int frames) { |