From 253d8fa82cfdbc1fa7571aa2cb3a9b2e7c2a5864 Mon Sep 17 00:00:00 2001 From: peah Date: Mon, 22 Feb 2016 02:00:09 -0800 Subject: [PATCH] Simplified the function for detecting whether capture data is modified. BUG= Review URL: https://codereview.webrtc.org/1701843004 Cr-Commit-Position: refs/heads/master@{#11704} --- .../audio_processing/audio_processing_impl.cc | 41 ++++--------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc index 74d5590627..e155171611 100644 --- a/webrtc/modules/audio_processing/audio_processing_impl.cc +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc @@ -1132,46 +1132,23 @@ VoiceDetection* AudioProcessingImpl::voice_detection() const { } bool AudioProcessingImpl::is_data_processed() const { - if (capture_nonlocked_.beamformer_enabled) { + // The beamformer, noise suppressor and highpass filter + // modify the data. + if (capture_nonlocked_.beamformer_enabled || + public_submodules_->high_pass_filter->is_enabled() || + public_submodules_->noise_suppression->is_enabled()) { return true; } - int enabled_count = 0; + // All of the private submodules modify the data. for (auto item : private_submodules_->component_list) { if (item->is_component_enabled()) { - enabled_count++; + return true; } } - if (public_submodules_->high_pass_filter->is_enabled()) { - enabled_count++; - } - if (public_submodules_->noise_suppression->is_enabled()) { - enabled_count++; - } - if (public_submodules_->level_estimator->is_enabled()) { - enabled_count++; - } - if (public_submodules_->voice_detection->is_enabled()) { - enabled_count++; - } - // Data is unchanged if no components are enabled, or if only - // public_submodules_->level_estimator - // or public_submodules_->voice_detection is enabled. - if (enabled_count == 0) { - return false; - } else if (enabled_count == 1) { - if (public_submodules_->level_estimator->is_enabled() || - public_submodules_->voice_detection->is_enabled()) { - return false; - } - } else if (enabled_count == 2) { - if (public_submodules_->level_estimator->is_enabled() && - public_submodules_->voice_detection->is_enabled()) { - return false; - } - } - return true; + // The capture data is otherwise unchanged. + return false; } bool AudioProcessingImpl::output_copy_needed(bool is_data_processed) const {