summaryrefslogtreecommitdiffstats
path: root/media/audio/mac
diff options
context:
space:
mode:
authordalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-08 21:30:37 +0000
committerdalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-08 21:30:37 +0000
commit7ed91e9093602872c62eba397fc1be8741089157 (patch)
tree6c4c2c6878ed51ca2e90586f11ea3887835c5e8c /media/audio/mac
parent13bfbc41308953ebea4952ff504037a261cfdd3c (diff)
downloadchromium_src-7ed91e9093602872c62eba397fc1be8741089157.zip
chromium_src-7ed91e9093602872c62eba397fc1be8741089157.tar.gz
chromium_src-7ed91e9093602872c62eba397fc1be8741089157.tar.bz2
Add vector_math::FMUL. Replace audio_util::AdjustVolume.
Removes the integer based volume adjustment code from the melting pot that is audio_util in favor of an AudioBus::AdjustVolume() method which works on float. The driver behind the method is a new vector_math::FMUL method which is SSE optimized. Benchmarks put it in line with the vector_math::FMAC() method. Benchmarking 200000 iterations: FMUL_C took 1962.52ms. FMUL_SSE (unaligned size) took 493.03ms; which is 3.98x faster than FMUL_C. FMUL_SSE (aligned size) took 491.79ms; which is 3.99x faster than FMUL_C and 1.00x faster than FMUL_SSE (unaligned size). BUG=120319, 171540, 226447 TEST=new media_unittests. Review URL: https://chromiumcodereview.appspot.com/13726011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/mac')
-rw-r--r--media/audio/mac/audio_auhal_mac.cc3
-rw-r--r--media/audio/mac/audio_low_latency_output_mac.cc10
2 files changed, 2 insertions, 11 deletions
diff --git a/media/audio/mac/audio_auhal_mac.cc b/media/audio/mac/audio_auhal_mac.cc
index 20df6f5..b2a8828 100644
--- a/media/audio/mac/audio_auhal_mac.cc
+++ b/media/audio/mac/audio_auhal_mac.cc
@@ -178,8 +178,6 @@ void AUHALStream::Stop() {
void AUHALStream::SetVolume(double volume) {
volume_ = static_cast<float>(volume);
-
- // TODO(crogers): set volume property
}
void AUHALStream::GetVolume(double* volume) {
@@ -251,6 +249,7 @@ OSStatus AUHALStream::Render(
input_bus_.get(),
output_bus_.get(),
AudioBuffersState(0, hardware_pending_bytes));
+ output_bus_->Scale(volume_);
}
return noErr;
diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc
index 4b82bef..592a6a1 100644
--- a/media/audio/mac/audio_low_latency_output_mac.cc
+++ b/media/audio/mac/audio_low_latency_output_mac.cc
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/mac/mac_logging.h"
-#include "media/audio/audio_util.h"
#include "media/audio/mac/audio_manager_mac.h"
#include "media/base/media_switches.h"
@@ -284,16 +283,9 @@ OSStatus AUAudioOutputStream::Render(UInt32 number_of_frames,
// Note: If this ever changes to output raw float the data must be clipped and
// sanitized since it may come from an untrusted source such as NaCl.
+ audio_bus_->Scale(volume_);
audio_bus_->ToInterleaved(
frames_filled, format_.mBitsPerChannel / 8, audio_data);
- uint32 filled = frames_filled * format_.mBytesPerFrame;
-
- // Perform in-place, software-volume adjustments.
- media::AdjustVolume(audio_data,
- filled,
- audio_bus_->channels(),
- format_.mBitsPerChannel / 8,
- volume_);
return noErr;
}