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

Unified Diff: media/audio/audio_device_thread.cc

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gotta catch'em all! Created 8 years, 4 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/audio/audio_device_thread.cc
diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc
index 83eb0c4e818a5e39c8e4438b15a5e0c689aa9e09..65c6077cfa9fbe1adb695a0f21fcf291038d086f 100644
--- a/media/audio/audio_device_thread.cc
+++ b/media/audio/audio_device_thread.cc
@@ -13,6 +13,7 @@
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "media/audio/audio_util.h"
+#include "media/base/audio_bus.h"
using base::PlatformThread;
@@ -188,23 +189,15 @@ AudioDeviceThread::Callback::Callback(
CHECK_NE(samples_per_ms_, 0);
}
-AudioDeviceThread::Callback::~Callback() {
- for (size_t i = 0; i < audio_data_.size(); ++i)
- base::AlignedFree(audio_data_[i]);
-}
+AudioDeviceThread::Callback::~Callback() {}
void AudioDeviceThread::Callback::InitializeOnAudioThread() {
- DCHECK(audio_data_.empty());
+ DCHECK(!audio_bus_.get());
MapSharedMemory();
DCHECK(shared_memory_.memory() != NULL);
- // Allocate buffer with a 16-byte alignment to allow SSE optimizations.
- audio_data_.reserve(audio_parameters_.channels());
- for (int i = 0; i < audio_parameters_.channels(); ++i) {
- audio_data_.push_back(static_cast<float*>(base::AlignedAlloc(
- sizeof(float) * audio_parameters_.frames_per_buffer(), 16)));
- }
+ audio_bus_ = AudioBus::Create(audio_parameters_);
DaleCurtis 2012/08/07 23:12:19 Coming back to my Q on the other CL, if we wrapped
scherkus (not reviewing) 2012/08/08 00:49:01 That seems like a worthwhile TODO / follow-up CL -
DaleCurtis 2012/08/08 01:26:07 Should be relatively simple. I'll add a TODO.
}
} // namespace media.

Powered by Google App Engine
This is Rietveld 408576698