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

Unified Diff: webrtc/voice_engine/utility.cc

Issue 2712743004: Support 4 channel mic in Windows Core Audio (Closed)
Patch Set: Fix another non-Windows build error 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
« no previous file with comments | « webrtc/modules/audio_device/win/audio_device_core_win.cc ('k') | webrtc/voice_engine/utility_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/utility.cc
diff --git a/webrtc/voice_engine/utility.cc b/webrtc/voice_engine/utility.cc
index 595c71182d9ca192eace4a4640f6f6cc20bdf222..720817fc0eaf478eccafbe5084c1a7cde80ad637 100644
--- a/webrtc/voice_engine/utility.cc
+++ b/webrtc/voice_engine/utility.cc
@@ -41,14 +41,20 @@ 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];
the sun 2017/03/02 00:57:29 nit: this isn't downsampled, it is downmixed.
hlundin-webrtc 2017/03/02 11:54:12 Fixing this in https://codereview.webrtc.org/27211
// 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_) {
+ RTC_DCHECK(num_channels == 2 || num_channels == 4)
+ << "num_channels: " << num_channels;
+ RTC_DCHECK(dst_frame->num_channels_ == 1 || dst_frame->num_channels_ == 2)
+ << "dst_frame->num_channels_: " << dst_frame->num_channels_;
+
+ AudioFrameOperations::DownmixChannels(
+ src_data, num_channels, samples_per_channel, dst_frame->num_channels_,
+ downsampled_audio);
+ audio_ptr = downsampled_audio;
+ audio_ptr_num_channels = dst_frame->num_channels_;
}
if (resampler->InitializeIfNeeded(sample_rate_hz, dst_frame->sample_rate_hz_,
« no previous file with comments | « webrtc/modules/audio_device/win/audio_device_core_win.cc ('k') | webrtc/voice_engine/utility_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698