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

Unified Diff: media/audio/audio_util.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_util.cc
diff --git a/media/audio/audio_util.cc b/media/audio/audio_util.cc
index a8ce2b53b1b2ade6aee0d4c602c23b129c53bca2..d04baff86eb017c0a410e84240ccd7e53e427ac9 100644
--- a/media/audio/audio_util.cc
+++ b/media/audio/audio_util.cc
@@ -22,6 +22,7 @@
#include "base/time.h"
#include "media/audio/audio_parameters.h"
#include "media/audio/audio_util.h"
+#include "media/base/audio_bus.h"
#if defined(OS_MACOSX)
#include "media/audio/mac/audio_low_latency_input_mac.h"
@@ -230,7 +231,7 @@ bool DeinterleaveAudioChannel(void* source,
// |Format| is the destination type, |Fixed| is a type larger than |Format|
// such that operations can be made without overflowing.
template<class Format, class Fixed>
-static void InterleaveFloatToInt(const std::vector<float*>& source,
+static void InterleaveFloatToInt(const AudioBus& source,
void* dst_bytes, size_t number_of_frames) {
Format* destination = reinterpret_cast<Format*>(dst_bytes);
Fixed max_value = std::numeric_limits<Format>::max();
@@ -243,9 +244,9 @@ static void InterleaveFloatToInt(const std::vector<float*>& source,
min_value = -(bias - 1);
}
- int channels = source.size();
+ int channels = source.channels();
for (int i = 0; i < channels; ++i) {
- float* channel_data = source[i];
+ const float* channel_data = source.channel(i);
for (size_t j = 0; j < number_of_frames; ++j) {
Fixed sample = max_value * channel_data[j];
if (sample > max_value)
@@ -258,7 +259,7 @@ static void InterleaveFloatToInt(const std::vector<float*>& source,
}
}
-void InterleaveFloatToInt(const std::vector<float*>& source, void* dst,
+void InterleaveFloatToInt(const AudioBus& source, void* dst,
size_t number_of_frames, int bytes_per_sample) {
switch (bytes_per_sample) {
case 1:

Powered by Google App Engine
This is Rietveld 408576698