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

Unified Diff: media/audio/audio_device_thread.cc

Issue 10802005: Add SSE optimizations to AudioRendererMixer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cast truncation. Created 8 years, 5 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 | « no previous file | media/base/audio_renderer_mixer.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 92831ab16c6d094c5c8447e320faa81d0ec7dc44..83eb0c4e818a5e39c8e4438b15a5e0c689aa9e09 100644
--- a/media/audio/audio_device_thread.cc
+++ b/media/audio/audio_device_thread.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/memory/aligned_memory.h"
#include "base/message_loop.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
@@ -189,7 +190,7 @@ AudioDeviceThread::Callback::Callback(
AudioDeviceThread::Callback::~Callback() {
for (size_t i = 0; i < audio_data_.size(); ++i)
- delete [] audio_data_[i];
+ base::AlignedFree(audio_data_[i]);
}
void AudioDeviceThread::Callback::InitializeOnAudioThread() {
@@ -198,10 +199,11 @@ void AudioDeviceThread::Callback::InitializeOnAudioThread() {
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) {
- float* channel_data = new float[audio_parameters_.frames_per_buffer()];
- audio_data_.push_back(channel_data);
+ audio_data_.push_back(static_cast<float*>(base::AlignedAlloc(
+ sizeof(float) * audio_parameters_.frames_per_buffer(), 16)));
}
}
« no previous file with comments | « no previous file | media/base/audio_renderer_mixer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698