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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2887693002: Avoid render resampling when there is no need for render signal analysis. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 changed |= first_update_; 214 changed |= first_update_;
215 first_update_ = false; 215 first_update_ = false;
216 return changed; 216 return changed;
217 } 217 }
218 218
219 bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandSubModulesActive() 219 bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandSubModulesActive()
220 const { 220 const {
221 #if WEBRTC_INTELLIGIBILITY_ENHANCER 221 #if WEBRTC_INTELLIGIBILITY_ENHANCER
222 return CaptureMultiBandProcessingActive() || 222 return CaptureMultiBandProcessingActive() ||
223 intelligibility_enhancer_enabled_ || 223 intelligibility_enhancer_enabled_ ||
224 voice_activity_detector_enabled_ || residual_echo_detector_enabled_; 224 voice_activity_detector_enabled_ || residual_echo_detector_enabled_;
peah-webrtc 2017/05/19 08:07:46 This change is due to a rebase.
225 #else 225 #else
226 return CaptureMultiBandProcessingActive() || 226 return CaptureMultiBandProcessingActive() ||
peah-webrtc 2017/05/19 08:07:46 This change is due to a rebase.
227 voice_activity_detector_enabled_ || residual_echo_detector_enabled_; 227 voice_activity_detector_enabled_ || residual_echo_detector_enabled_;
228 #endif 228 #endif
229 } 229 }
230 230
231 bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandProcessingActive() 231 bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandProcessingActive()
232 const { 232 const {
233 return low_cut_filter_enabled_ || echo_canceller_enabled_ || 233 return low_cut_filter_enabled_ || echo_canceller_enabled_ ||
234 mobile_echo_controller_enabled_ || noise_suppressor_enabled_ || 234 mobile_echo_controller_enabled_ || noise_suppressor_enabled_ ||
235 beamformer_enabled_ || adaptive_gain_controller_enabled_ || 235 beamformer_enabled_ || adaptive_gain_controller_enabled_ ||
236 echo_canceller3_enabled_; 236 echo_canceller3_enabled_;
237 } 237 }
238 238
239 bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandSubModulesActive() 239 bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandSubModulesActive()
240 const { 240 const {
241 return RenderMultiBandProcessingActive() || echo_canceller_enabled_ || 241 return RenderMultiBandProcessingActive() || echo_canceller_enabled_ ||
242 mobile_echo_controller_enabled_ || adaptive_gain_controller_enabled_ || 242 mobile_echo_controller_enabled_ || adaptive_gain_controller_enabled_ ||
peah-webrtc 2017/05/19 08:07:46 This change is due to a rebase.
243 residual_echo_detector_enabled_ || echo_canceller3_enabled_; 243 residual_echo_detector_enabled_ || echo_canceller3_enabled_;
244 } 244 }
245 245
246 bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandProcessingActive() 246 bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandProcessingActive()
247 const { 247 const {
248 #if WEBRTC_INTELLIGIBILITY_ENHANCER 248 #if WEBRTC_INTELLIGIBILITY_ENHANCER
249 return intelligibility_enhancer_enabled_; 249 return intelligibility_enhancer_enabled_;
250 #else 250 #else
251 return false; 251 return false;
252 #endif 252 #endif
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() == 591 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
592 kSampleRate8kHz) { 592 kSampleRate8kHz) {
593 render_processing_rate = kSampleRate8kHz; 593 render_processing_rate = kSampleRate8kHz;
594 } else { 594 } else {
595 render_processing_rate = 595 render_processing_rate =
596 std::max(render_processing_rate, static_cast<int>(kSampleRate16kHz)); 596 std::max(render_processing_rate, static_cast<int>(kSampleRate16kHz));
597 } 597 }
598 598
599 // Always downmix the render stream to mono for analysis. This has been 599 // Always downmix the render stream to mono for analysis. This has been
600 // demonstrated to work well for AEC in most practical scenarios. 600 // demonstrated to work well for AEC in most practical scenarios.
601 formats_.render_processing_format = StreamConfig(render_processing_rate, 1); 601 if (submodule_states_.RenderMultiBandSubModulesActive()) {
602 formats_.render_processing_format = StreamConfig(render_processing_rate, 1);
603 } else {
604 formats_.render_processing_format = StreamConfig(
605 formats_.api_format.reverse_input_stream().sample_rate_hz(),
606 formats_.api_format.output_stream().num_channels());
607 }
602 608
603 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() == 609 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
604 kSampleRate32kHz || 610 kSampleRate32kHz ||
605 capture_nonlocked_.capture_processing_format.sample_rate_hz() == 611 capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
606 kSampleRate48kHz) { 612 kSampleRate48kHz) {
607 capture_nonlocked_.split_rate = kSampleRate16kHz; 613 capture_nonlocked_.split_rate = kSampleRate16kHz;
608 } else { 614 } else {
609 capture_nonlocked_.split_rate = 615 capture_nonlocked_.split_rate =
610 capture_nonlocked_.capture_processing_format.sample_rate_hz(); 616 capture_nonlocked_.capture_processing_format.sample_rate_hz();
611 } 617 }
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 previous_agc_level(0), 2020 previous_agc_level(0),
2015 echo_path_gain_change(false) {} 2021 echo_path_gain_change(false) {}
2016 2022
2017 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 2023 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
2018 2024
2019 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 2025 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
2020 2026
2021 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 2027 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
2022 2028
2023 } // namespace webrtc 2029 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698