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

Unified Diff: content/renderer/media/audio_device_thread.cc

Issue 10802005: Add SSE optimizations to AudioRendererMixer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments! 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') | media/base/audio_renderer_mixer.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/audio_device_thread.cc
diff --git a/content/renderer/media/audio_device_thread.cc b/content/renderer/media/audio_device_thread.cc
index 64a4cd62ed0729117412e4d7080de83fc59b871f..bd0b7da354d7d6adb897d6b35abd6ad3ff0c7e3d 100644
--- a/content/renderer/media/audio_device_thread.cc
+++ b/content/renderer/media/audio_device_thread.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/memory/aligned_memory.h"
Ami GONE FROM CHROMIUM 2012/07/27 17:33:11 CL description says "without the hassle of 32-byte
DaleCurtis 2012/07/27 21:23:42 There I'm specifically referring to versus FFMpeg'
#include "base/message_loop.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
@@ -185,7 +186,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() {
@@ -194,9 +195,10 @@ 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') | media/base/audio_renderer_mixer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698