Index: media/base/audio_bus.cc |
diff --git a/media/base/audio_bus.cc b/media/base/audio_bus.cc |
index 2b0379a7542bc4672abd51d256394b4700f7c94d..0a59583bc0200fe530f355d1eee05d3b33adce2a 100644 |
--- a/media/base/audio_bus.cc |
+++ b/media/base/audio_bus.cc |
@@ -297,6 +297,22 @@ void AudioBus::ToInterleaved(int frames, int bytes_per_sample, |
ToInterleavedPartial(0, frames, bytes_per_sample, dest); |
} |
+// Interleaves |audio_bus| channels() of floats into a single output linear |
+// |buffer|. |
+void AudioBus::ToInterleavedFloat(int source_offset, |
+ int destination_offset, |
+ int num_samples, |
mcasas
2016/04/11 23:47:08
This parameter is called |int num_channels| in the
|
+ float* buffer) const { |
+ CheckOverflow(source_offset, destination_offset, num_samples); |
+ for (int ch = 0; ch < channels(); ++ch) { |
+ const float* src = channel(ch) + source_offset; |
+ const float* const src_end = src + num_samples; |
+ float* dest = buffer + destination_offset + ch; |
+ for (; src < src_end; ++src, dest += channels()) |
+ *dest = *src; |
+ } |
+} |
+ |
// TODO(dalecurtis): See if intrinsic optimizations help any here. |
void AudioBus::ToInterleavedPartial(int start_frame, int frames, |
int bytes_per_sample, void* dest) const { |