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

Unified Diff: media/base/audio_bus.cc

Issue 1769373003: AudioBus: Add a ToInterleavedFloat() method to AudioBus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/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 {

Powered by Google App Engine
This is Rietveld 408576698