From 63a2c13d6dddab0331fb1fff42620c3c694f8017 Mon Sep 17 00:00:00 2001 From: Alejandro Luebs Date: Thu, 31 Mar 2016 18:04:40 -0700 Subject: [PATCH] Only split into bands when the reverse stream is analyzed in the APM BUG=596079 R=henrik.lundin@webrtc.org, peah@webrtc.org Review URL: https://codereview.webrtc.org/1844583003 . Cr-Commit-Position: refs/heads/master@{#12187} --- .../audio_processing/audio_processing_impl.cc | 14 +++++++++----- .../audio_processing/audio_processing_impl.h | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index a09c1c9acf..9fd18fcb65 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -1099,7 +1099,7 @@ VoiceDetection* AudioProcessingImpl::voice_detection() const { return public_submodules_->voice_detection.get(); } -bool AudioProcessingImpl::is_data_processed() const { +bool AudioProcessingImpl::is_fwd_processed() const { // The beamformer, noise suppressor and highpass filter // modify the data. if (capture_nonlocked_.beamformer_enabled || @@ -1119,16 +1119,16 @@ bool AudioProcessingImpl::output_copy_needed() const { // Check if we've upmixed or downmixed the audio. return ((formats_.api_format.output_stream().num_channels() != formats_.api_format.input_stream().num_channels()) || - is_data_processed() || capture_.transient_suppressor_enabled); + is_fwd_processed() || capture_.transient_suppressor_enabled); } bool AudioProcessingImpl::fwd_synthesis_needed() const { - return (is_data_processed() && + return (is_fwd_processed() && is_multi_band(capture_nonlocked_.fwd_proc_format.sample_rate_hz())); } bool AudioProcessingImpl::fwd_analysis_needed() const { - if (!is_data_processed() && + if (!is_fwd_processed() && !public_submodules_->voice_detection->is_enabled() && !capture_.transient_suppressor_enabled) { // Only public_submodules_->level_estimator is enabled. @@ -1152,7 +1152,11 @@ bool AudioProcessingImpl::rev_synthesis_needed() const { } bool AudioProcessingImpl::rev_analysis_needed() const { - return is_multi_band(formats_.rev_proc_format.sample_rate_hz()); + return is_multi_band(formats_.rev_proc_format.sample_rate_hz()) && + (is_rev_processed() || + public_submodules_->echo_cancellation->is_enabled() || + public_submodules_->echo_control_mobile->is_enabled() || + public_submodules_->gain_control->is_enabled()); } bool AudioProcessingImpl::render_check_rev_conversion_needed() const { diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h index 283071ba3e..7323b85c78 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.h +++ b/webrtc/modules/audio_processing/audio_processing_impl.h @@ -207,7 +207,7 @@ class AudioProcessingImpl : public AudioProcessing { // manner that are called with the render lock already acquired. int ProcessStreamLocked() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); bool output_copy_needed() const EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); - bool is_data_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); + bool is_fwd_processed() const EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); bool fwd_synthesis_needed() const EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); bool fwd_analysis_needed() const EXCLUSIVE_LOCKS_REQUIRED(crit_capture_); void MaybeUpdateHistograms() EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);