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 { |