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

Unified Diff: webrtc/voice_engine/utility.cc

Issue 2712743004: Support 4 channel mic in Windows Core Audio (Closed)
Patch Set: Fix formatting Created 3 years, 10 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: webrtc/voice_engine/utility.cc
diff --git a/webrtc/voice_engine/utility.cc b/webrtc/voice_engine/utility.cc
index 595c71182d9ca192eace4a4640f6f6cc20bdf222..9e6743c56ec853e51973e6bf1543d2c526144d83 100644
--- a/webrtc/voice_engine/utility.cc
+++ b/webrtc/voice_engine/utility.cc
@@ -41,14 +41,15 @@ void RemixAndResample(const int16_t* src_data,
AudioFrame* dst_frame) {
const int16_t* audio_ptr = src_data;
size_t audio_ptr_num_channels = num_channels;
- int16_t mono_audio[AudioFrame::kMaxDataSizeSamples];
+ int16_t downsampled_audio[AudioFrame::kMaxDataSizeSamples];
// Downmix before resampling.
- if (num_channels == 2 && dst_frame->num_channels_ == 1) {
- AudioFrameOperations::StereoToMono(src_data, samples_per_channel,
- mono_audio);
- audio_ptr = mono_audio;
- audio_ptr_num_channels = 1;
+ if (num_channels > dst_frame->num_channels_) {
+ AudioFrameOperations::DownmixChannels(
jens.nielsen 2017/02/23 16:29:18 Maybe needs some error handling here for unsupport
hlundin-webrtc 2017/02/24 09:46:36 I think this leaves the field a little too open. I
jens.nielsen 2017/02/24 14:55:49 Done.
+ src_data, num_channels, samples_per_channel,downsampled_audio,
+ dst_frame->num_channels_);
+ audio_ptr = downsampled_audio;
+ audio_ptr_num_channels = dst_frame->num_channels_;
}
if (resampler->InitializeIfNeeded(sample_rate_hz, dst_frame->sample_rate_hz_,

Powered by Google App Engine
This is Rietveld 408576698