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

Unified Diff: media/cast/sender/audio_encoder.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
« media/base/audio_bus_unittest.cc ('K') | « media/base/audio_bus_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/audio_encoder.cc
diff --git a/media/cast/sender/audio_encoder.cc b/media/cast/sender/audio_encoder.cc
index bacb793fddbb6b9fd1cfc23de5fca3fcc36fcb66..a67664925f308db80cdc96a651b88b870c78ef40 100644
--- a/media/cast/sender/audio_encoder.cc
+++ b/media/cast/sender/audio_encoder.cc
@@ -283,14 +283,11 @@ class AudioEncoder::OpusImpl : public AudioEncoder::ImplBase {
int source_offset,
int buffer_fill_offset,
int num_samples) final {
+ DCHECK_EQ(audio_bus->channels(), num_channels_);
mcasas 2016/04/11 23:47:08 nit: Expected value goes first, and I think in th
// Opus requires channel-interleaved samples in a single array.
- for (int ch = 0; ch < audio_bus->channels(); ++ch) {
- const float* src = audio_bus->channel(ch) + source_offset;
- const float* const src_end = src + num_samples;
- float* dest = buffer_.get() + buffer_fill_offset * num_channels_ + ch;
- for (; src < src_end; ++src, dest += num_channels_)
- *dest = *src;
- }
+ audio_bus->ToInterleavedFloat(source_offset,
+ buffer_fill_offset * num_channels_,
+ num_samples, buffer_.get());
}
bool EncodeFromFilledBuffer(std::string* out) final {
« media/base/audio_bus_unittest.cc ('K') | « media/base/audio_bus_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698