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

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: Cleanup MCR AudioBus usage. 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
« no previous file with comments | « media/audio/audio_device_thread.h ('k') | media/audio/audio_input_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3e14d3de53929ae88488fe03fc200c325529ca89 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,17 @@ 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)));
- }
+ // TODO(dalecurtis): Instead of creating a new AudioBus and memcpy'ing into
+ // the shared memory we should wrap the shared memory.
+ audio_bus_ = AudioBus::Create(audio_parameters_);
}
} // namespace media.
« no previous file with comments | « media/audio/audio_device_thread.h ('k') | media/audio/audio_input_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698