Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: media/base/audio_bus.cc

Issue 10909185: Add Mac OS X synchronized audio I/O back-end (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698