| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" | 28 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" |
| 29 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" | 29 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" |
| 30 #include "webrtc/modules/audio_processing/gain_control_impl.h" | 30 #include "webrtc/modules/audio_processing/gain_control_impl.h" |
| 31 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" | 31 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" |
| 32 #if WEBRTC_INTELLIGIBILITY_ENHANCER | 32 #if WEBRTC_INTELLIGIBILITY_ENHANCER |
| 33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" | 33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc
er.h" |
| 34 #endif | 34 #endif |
| 35 #include "webrtc/modules/audio_processing/level_controller/level_controller.h" | 35 #include "webrtc/modules/audio_processing/level_controller/level_controller.h" |
| 36 #include "webrtc/modules/audio_processing/level_estimator_impl.h" | 36 #include "webrtc/modules/audio_processing/level_estimator_impl.h" |
| 37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" | 37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" |
| 38 #include "webrtc/modules/audio_processing/residual_echo_detector.h" |
| 38 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" | 39 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" |
| 39 #include "webrtc/modules/audio_processing/voice_detection_impl.h" | 40 #include "webrtc/modules/audio_processing/voice_detection_impl.h" |
| 40 #include "webrtc/modules/include/module_common_types.h" | 41 #include "webrtc/modules/include/module_common_types.h" |
| 41 #include "webrtc/system_wrappers/include/file_wrapper.h" | 42 #include "webrtc/system_wrappers/include/file_wrapper.h" |
| 42 #include "webrtc/system_wrappers/include/logging.h" | 43 #include "webrtc/system_wrappers/include/logging.h" |
| 43 #include "webrtc/system_wrappers/include/metrics.h" | 44 #include "webrtc/system_wrappers/include/metrics.h" |
| 44 | 45 |
| 45 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 46 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
| 46 // Files generated at build-time by the protobuf compiler. | 47 // Files generated at build-time by the protobuf compiler. |
| 47 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 48 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 // Throughout webrtc, it's assumed that success is represented by zero. | 125 // Throughout webrtc, it's assumed that success is represented by zero. |
| 125 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); | 126 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); |
| 126 | 127 |
| 127 AudioProcessingImpl::ApmSubmoduleStates::ApmSubmoduleStates() {} | 128 AudioProcessingImpl::ApmSubmoduleStates::ApmSubmoduleStates() {} |
| 128 | 129 |
| 129 bool AudioProcessingImpl::ApmSubmoduleStates::Update( | 130 bool AudioProcessingImpl::ApmSubmoduleStates::Update( |
| 130 bool high_pass_filter_enabled, | 131 bool high_pass_filter_enabled, |
| 131 bool echo_canceller_enabled, | 132 bool echo_canceller_enabled, |
| 132 bool mobile_echo_controller_enabled, | 133 bool mobile_echo_controller_enabled, |
| 134 bool residual_echo_detector_enabled, |
| 133 bool noise_suppressor_enabled, | 135 bool noise_suppressor_enabled, |
| 134 bool intelligibility_enhancer_enabled, | 136 bool intelligibility_enhancer_enabled, |
| 135 bool beamformer_enabled, | 137 bool beamformer_enabled, |
| 136 bool adaptive_gain_controller_enabled, | 138 bool adaptive_gain_controller_enabled, |
| 137 bool level_controller_enabled, | 139 bool level_controller_enabled, |
| 138 bool voice_activity_detector_enabled, | 140 bool voice_activity_detector_enabled, |
| 139 bool level_estimator_enabled, | 141 bool level_estimator_enabled, |
| 140 bool transient_suppressor_enabled) { | 142 bool transient_suppressor_enabled) { |
| 141 bool changed = false; | 143 bool changed = false; |
| 142 changed |= (high_pass_filter_enabled != high_pass_filter_enabled_); | 144 changed |= (high_pass_filter_enabled != high_pass_filter_enabled_); |
| 143 changed |= (echo_canceller_enabled != echo_canceller_enabled_); | 145 changed |= (echo_canceller_enabled != echo_canceller_enabled_); |
| 144 changed |= | 146 changed |= |
| 145 (mobile_echo_controller_enabled != mobile_echo_controller_enabled_); | 147 (mobile_echo_controller_enabled != mobile_echo_controller_enabled_); |
| 148 changed |= |
| 149 (residual_echo_detector_enabled != residual_echo_detector_enabled_); |
| 146 changed |= (noise_suppressor_enabled != noise_suppressor_enabled_); | 150 changed |= (noise_suppressor_enabled != noise_suppressor_enabled_); |
| 147 changed |= | 151 changed |= |
| 148 (intelligibility_enhancer_enabled != intelligibility_enhancer_enabled_); | 152 (intelligibility_enhancer_enabled != intelligibility_enhancer_enabled_); |
| 149 changed |= (beamformer_enabled != beamformer_enabled_); | 153 changed |= (beamformer_enabled != beamformer_enabled_); |
| 150 changed |= | 154 changed |= |
| 151 (adaptive_gain_controller_enabled != adaptive_gain_controller_enabled_); | 155 (adaptive_gain_controller_enabled != adaptive_gain_controller_enabled_); |
| 152 changed |= (level_controller_enabled != level_controller_enabled_); | 156 changed |= (level_controller_enabled != level_controller_enabled_); |
| 153 changed |= (level_estimator_enabled != level_estimator_enabled_); | 157 changed |= (level_estimator_enabled != level_estimator_enabled_); |
| 154 changed |= | 158 changed |= |
| 155 (voice_activity_detector_enabled != voice_activity_detector_enabled_); | 159 (voice_activity_detector_enabled != voice_activity_detector_enabled_); |
| 156 changed |= (transient_suppressor_enabled != transient_suppressor_enabled_); | 160 changed |= (transient_suppressor_enabled != transient_suppressor_enabled_); |
| 157 if (changed) { | 161 if (changed) { |
| 158 high_pass_filter_enabled_ = high_pass_filter_enabled; | 162 high_pass_filter_enabled_ = high_pass_filter_enabled; |
| 159 echo_canceller_enabled_ = echo_canceller_enabled; | 163 echo_canceller_enabled_ = echo_canceller_enabled; |
| 160 mobile_echo_controller_enabled_ = mobile_echo_controller_enabled; | 164 mobile_echo_controller_enabled_ = mobile_echo_controller_enabled; |
| 165 residual_echo_detector_enabled_ = residual_echo_detector_enabled; |
| 161 noise_suppressor_enabled_ = noise_suppressor_enabled; | 166 noise_suppressor_enabled_ = noise_suppressor_enabled; |
| 162 intelligibility_enhancer_enabled_ = intelligibility_enhancer_enabled; | 167 intelligibility_enhancer_enabled_ = intelligibility_enhancer_enabled; |
| 163 beamformer_enabled_ = beamformer_enabled; | 168 beamformer_enabled_ = beamformer_enabled; |
| 164 adaptive_gain_controller_enabled_ = adaptive_gain_controller_enabled; | 169 adaptive_gain_controller_enabled_ = adaptive_gain_controller_enabled; |
| 165 level_controller_enabled_ = level_controller_enabled; | 170 level_controller_enabled_ = level_controller_enabled; |
| 166 level_estimator_enabled_ = level_estimator_enabled; | 171 level_estimator_enabled_ = level_estimator_enabled; |
| 167 voice_activity_detector_enabled_ = voice_activity_detector_enabled; | 172 voice_activity_detector_enabled_ = voice_activity_detector_enabled; |
| 168 transient_suppressor_enabled_ = transient_suppressor_enabled; | 173 transient_suppressor_enabled_ = transient_suppressor_enabled; |
| 169 } | 174 } |
| 170 | 175 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 std::unique_ptr<GainControlImpl> gain_control; | 218 std::unique_ptr<GainControlImpl> gain_control; |
| 214 std::unique_ptr<HighPassFilterImpl> high_pass_filter; | 219 std::unique_ptr<HighPassFilterImpl> high_pass_filter; |
| 215 std::unique_ptr<LevelEstimatorImpl> level_estimator; | 220 std::unique_ptr<LevelEstimatorImpl> level_estimator; |
| 216 std::unique_ptr<NoiseSuppressionImpl> noise_suppression; | 221 std::unique_ptr<NoiseSuppressionImpl> noise_suppression; |
| 217 std::unique_ptr<VoiceDetectionImpl> voice_detection; | 222 std::unique_ptr<VoiceDetectionImpl> voice_detection; |
| 218 std::unique_ptr<GainControlForExperimentalAgc> | 223 std::unique_ptr<GainControlForExperimentalAgc> |
| 219 gain_control_for_experimental_agc; | 224 gain_control_for_experimental_agc; |
| 220 | 225 |
| 221 // Accessed internally from both render and capture. | 226 // Accessed internally from both render and capture. |
| 222 std::unique_ptr<TransientSuppressor> transient_suppressor; | 227 std::unique_ptr<TransientSuppressor> transient_suppressor; |
| 228 std::unique_ptr<ResidualEchoDetector> residual_echo_detector; |
| 223 #if WEBRTC_INTELLIGIBILITY_ENHANCER | 229 #if WEBRTC_INTELLIGIBILITY_ENHANCER |
| 224 std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer; | 230 std::unique_ptr<IntelligibilityEnhancer> intelligibility_enhancer; |
| 225 #endif | 231 #endif |
| 226 }; | 232 }; |
| 227 | 233 |
| 228 struct AudioProcessingImpl::ApmPrivateSubmodules { | 234 struct AudioProcessingImpl::ApmPrivateSubmodules { |
| 229 explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer) | 235 explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer) |
| 230 : beamformer(beamformer) {} | 236 : beamformer(beamformer) {} |
| 231 // Accessed internally from capture or during initialization | 237 // Accessed internally from capture or during initialization |
| 232 std::unique_ptr<NonlinearBeamformer> beamformer; | 238 std::unique_ptr<NonlinearBeamformer> beamformer; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 new HighPassFilterImpl(&crit_capture_)); | 296 new HighPassFilterImpl(&crit_capture_)); |
| 291 public_submodules_->level_estimator.reset( | 297 public_submodules_->level_estimator.reset( |
| 292 new LevelEstimatorImpl(&crit_capture_)); | 298 new LevelEstimatorImpl(&crit_capture_)); |
| 293 public_submodules_->noise_suppression.reset( | 299 public_submodules_->noise_suppression.reset( |
| 294 new NoiseSuppressionImpl(&crit_capture_)); | 300 new NoiseSuppressionImpl(&crit_capture_)); |
| 295 public_submodules_->voice_detection.reset( | 301 public_submodules_->voice_detection.reset( |
| 296 new VoiceDetectionImpl(&crit_capture_)); | 302 new VoiceDetectionImpl(&crit_capture_)); |
| 297 public_submodules_->gain_control_for_experimental_agc.reset( | 303 public_submodules_->gain_control_for_experimental_agc.reset( |
| 298 new GainControlForExperimentalAgc( | 304 new GainControlForExperimentalAgc( |
| 299 public_submodules_->gain_control.get(), &crit_capture_)); | 305 public_submodules_->gain_control.get(), &crit_capture_)); |
| 306 public_submodules_->residual_echo_detector.reset( |
| 307 new ResidualEchoDetector(&crit_render_, &crit_capture_)); |
| 300 | 308 |
| 301 // TODO(peah): Move this creation to happen only when the level controller | 309 // TODO(peah): Move this creation to happen only when the level controller |
| 302 // is enabled. | 310 // is enabled. |
| 303 private_submodules_->level_controller.reset(new LevelController()); | 311 private_submodules_->level_controller.reset(new LevelController()); |
| 304 } | 312 } |
| 305 | 313 |
| 306 SetExtraOptions(config); | 314 SetExtraOptions(config); |
| 307 } | 315 } |
| 308 | 316 |
| 309 AudioProcessingImpl::~AudioProcessingImpl() { | 317 AudioProcessingImpl::~AudioProcessingImpl() { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 #if WEBRTC_INTELLIGIBILITY_ENHANCER | 460 #if WEBRTC_INTELLIGIBILITY_ENHANCER |
| 453 InitializeIntelligibility(); | 461 InitializeIntelligibility(); |
| 454 #endif | 462 #endif |
| 455 public_submodules_->high_pass_filter->Initialize(num_proc_channels(), | 463 public_submodules_->high_pass_filter->Initialize(num_proc_channels(), |
| 456 proc_sample_rate_hz()); | 464 proc_sample_rate_hz()); |
| 457 public_submodules_->noise_suppression->Initialize(num_proc_channels(), | 465 public_submodules_->noise_suppression->Initialize(num_proc_channels(), |
| 458 proc_sample_rate_hz()); | 466 proc_sample_rate_hz()); |
| 459 public_submodules_->voice_detection->Initialize(proc_split_sample_rate_hz()); | 467 public_submodules_->voice_detection->Initialize(proc_split_sample_rate_hz()); |
| 460 public_submodules_->level_estimator->Initialize(); | 468 public_submodules_->level_estimator->Initialize(); |
| 461 InitializeLevelController(); | 469 InitializeLevelController(); |
| 470 InitializeResidualEchoDetector(); |
| 462 | 471 |
| 463 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 472 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
| 464 if (debug_dump_.debug_file->is_open()) { | 473 if (debug_dump_.debug_file->is_open()) { |
| 465 int err = WriteInitMessage(); | 474 int err = WriteInitMessage(); |
| 466 if (err != kNoError) { | 475 if (err != kNoError) { |
| 467 return err; | 476 return err; |
| 468 } | 477 } |
| 469 } | 478 } |
| 470 #endif | 479 #endif |
| 471 | 480 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 ProcessingConfig processing_config; | 702 ProcessingConfig processing_config; |
| 694 bool reinitialization_required = false; | 703 bool reinitialization_required = false; |
| 695 { | 704 { |
| 696 // Acquire the capture lock in order to safely call the function | 705 // Acquire the capture lock in order to safely call the function |
| 697 // that retrieves the render side data. This function accesses apm | 706 // that retrieves the render side data. This function accesses apm |
| 698 // getters that need the capture lock held when being called. | 707 // getters that need the capture lock held when being called. |
| 699 rtc::CritScope cs_capture(&crit_capture_); | 708 rtc::CritScope cs_capture(&crit_capture_); |
| 700 public_submodules_->echo_cancellation->ReadQueuedRenderData(); | 709 public_submodules_->echo_cancellation->ReadQueuedRenderData(); |
| 701 public_submodules_->echo_control_mobile->ReadQueuedRenderData(); | 710 public_submodules_->echo_control_mobile->ReadQueuedRenderData(); |
| 702 public_submodules_->gain_control->ReadQueuedRenderData(); | 711 public_submodules_->gain_control->ReadQueuedRenderData(); |
| 712 public_submodules_->residual_echo_detector->ReadQueuedRenderData(); |
| 703 | 713 |
| 704 if (!src || !dest) { | 714 if (!src || !dest) { |
| 705 return kNullPointerError; | 715 return kNullPointerError; |
| 706 } | 716 } |
| 707 | 717 |
| 708 processing_config = formats_.api_format; | 718 processing_config = formats_.api_format; |
| 709 reinitialization_required = UpdateActiveSubmoduleStates(); | 719 reinitialization_required = UpdateActiveSubmoduleStates(); |
| 710 } | 720 } |
| 711 | 721 |
| 712 processing_config.input_stream() = input_config; | 722 processing_config.input_stream() = input_config; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 // Acquire the capture lock in order to safely call the function | 773 // Acquire the capture lock in order to safely call the function |
| 764 // that retrieves the render side data. This function accesses apm | 774 // that retrieves the render side data. This function accesses apm |
| 765 // getters that need the capture lock held when being called. | 775 // getters that need the capture lock held when being called. |
| 766 // The lock needs to be released as | 776 // The lock needs to be released as |
| 767 // public_submodules_->echo_control_mobile->is_enabled() aquires this lock | 777 // public_submodules_->echo_control_mobile->is_enabled() aquires this lock |
| 768 // as well. | 778 // as well. |
| 769 rtc::CritScope cs_capture(&crit_capture_); | 779 rtc::CritScope cs_capture(&crit_capture_); |
| 770 public_submodules_->echo_cancellation->ReadQueuedRenderData(); | 780 public_submodules_->echo_cancellation->ReadQueuedRenderData(); |
| 771 public_submodules_->echo_control_mobile->ReadQueuedRenderData(); | 781 public_submodules_->echo_control_mobile->ReadQueuedRenderData(); |
| 772 public_submodules_->gain_control->ReadQueuedRenderData(); | 782 public_submodules_->gain_control->ReadQueuedRenderData(); |
| 783 public_submodules_->residual_echo_detector->ReadQueuedRenderData(); |
| 773 } | 784 } |
| 774 | 785 |
| 775 if (!frame) { | 786 if (!frame) { |
| 776 return kNullPointerError; | 787 return kNullPointerError; |
| 777 } | 788 } |
| 778 // Must be a native rate. | 789 // Must be a native rate. |
| 779 if (frame->sample_rate_hz_ != kSampleRate8kHz && | 790 if (frame->sample_rate_hz_ != kSampleRate8kHz && |
| 780 frame->sample_rate_hz_ != kSampleRate16kHz && | 791 frame->sample_rate_hz_ != kSampleRate16kHz && |
| 781 frame->sample_rate_hz_ != kSampleRate32kHz && | 792 frame->sample_rate_hz_ != kSampleRate32kHz && |
| 782 frame->sample_rate_hz_ != kSampleRate48kHz) { | 793 frame->sample_rate_hz_ != kSampleRate48kHz) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // Ensure that the stream delay was set before the call to the | 936 // Ensure that the stream delay was set before the call to the |
| 926 // AECM ProcessCaptureAudio function. | 937 // AECM ProcessCaptureAudio function. |
| 927 if (public_submodules_->echo_control_mobile->is_enabled() && | 938 if (public_submodules_->echo_control_mobile->is_enabled() && |
| 928 !was_stream_delay_set()) { | 939 !was_stream_delay_set()) { |
| 929 return AudioProcessing::kStreamParameterNotSetError; | 940 return AudioProcessing::kStreamParameterNotSetError; |
| 930 } | 941 } |
| 931 | 942 |
| 932 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessCaptureAudio( | 943 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessCaptureAudio( |
| 933 capture_buffer, stream_delay_ms())); | 944 capture_buffer, stream_delay_ms())); |
| 934 | 945 |
| 946 if (config_.residual_echo_detector.enabled) { |
| 947 public_submodules_->residual_echo_detector->AnalyzeCaptureAudio( |
| 948 capture_buffer); |
| 949 } |
| 950 |
| 935 if (capture_nonlocked_.beamformer_enabled) { | 951 if (capture_nonlocked_.beamformer_enabled) { |
| 936 private_submodules_->beamformer->PostFilter(capture_buffer->split_data_f()); | 952 private_submodules_->beamformer->PostFilter(capture_buffer->split_data_f()); |
| 937 } | 953 } |
| 938 | 954 |
| 939 public_submodules_->voice_detection->ProcessCaptureAudio(capture_buffer); | 955 public_submodules_->voice_detection->ProcessCaptureAudio(capture_buffer); |
| 940 | 956 |
| 941 if (constants_.use_experimental_agc && | 957 if (constants_.use_experimental_agc && |
| 942 public_submodules_->gain_control->is_enabled() && | 958 public_submodules_->gain_control->is_enabled() && |
| 943 (!capture_nonlocked_.beamformer_enabled || | 959 (!capture_nonlocked_.beamformer_enabled || |
| 944 private_submodules_->beamformer->is_target_present())) { | 960 private_submodules_->beamformer->is_target_present())) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 if (capture_nonlocked_.intelligibility_enabled) { | 1143 if (capture_nonlocked_.intelligibility_enabled) { |
| 1128 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( | 1144 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( |
| 1129 render_buffer); | 1145 render_buffer); |
| 1130 } | 1146 } |
| 1131 #endif | 1147 #endif |
| 1132 | 1148 |
| 1133 RETURN_ON_ERR( | 1149 RETURN_ON_ERR( |
| 1134 public_submodules_->echo_cancellation->ProcessRenderAudio(render_buffer)); | 1150 public_submodules_->echo_cancellation->ProcessRenderAudio(render_buffer)); |
| 1135 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessRenderAudio( | 1151 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessRenderAudio( |
| 1136 render_buffer)); | 1152 render_buffer)); |
| 1153 if (config_.residual_echo_detector.enabled) { |
| 1154 public_submodules_->residual_echo_detector->AnalyzeRenderAudio( |
| 1155 render_buffer); |
| 1156 } |
| 1137 if (!constants_.use_experimental_agc) { | 1157 if (!constants_.use_experimental_agc) { |
| 1138 RETURN_ON_ERR( | 1158 RETURN_ON_ERR( |
| 1139 public_submodules_->gain_control->ProcessRenderAudio(render_buffer)); | 1159 public_submodules_->gain_control->ProcessRenderAudio(render_buffer)); |
| 1140 } | 1160 } |
| 1141 | 1161 |
| 1142 if (submodule_states_.RenderMultiBandProcessingActive() && | 1162 if (submodule_states_.RenderMultiBandProcessingActive() && |
| 1143 SampleRateSupportsMultiBand( | 1163 SampleRateSupportsMultiBand( |
| 1144 formats_.render_processing_format.sample_rate_hz())) { | 1164 formats_.render_processing_format.sample_rate_hz())) { |
| 1145 render_buffer->MergeFrequencyBands(); | 1165 render_buffer->MergeFrequencyBands(); |
| 1146 } | 1166 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1303 | 1323 |
| 1304 VoiceDetection* AudioProcessingImpl::voice_detection() const { | 1324 VoiceDetection* AudioProcessingImpl::voice_detection() const { |
| 1305 return public_submodules_->voice_detection.get(); | 1325 return public_submodules_->voice_detection.get(); |
| 1306 } | 1326 } |
| 1307 | 1327 |
| 1308 bool AudioProcessingImpl::UpdateActiveSubmoduleStates() { | 1328 bool AudioProcessingImpl::UpdateActiveSubmoduleStates() { |
| 1309 return submodule_states_.Update( | 1329 return submodule_states_.Update( |
| 1310 public_submodules_->high_pass_filter->is_enabled(), | 1330 public_submodules_->high_pass_filter->is_enabled(), |
| 1311 public_submodules_->echo_cancellation->is_enabled(), | 1331 public_submodules_->echo_cancellation->is_enabled(), |
| 1312 public_submodules_->echo_control_mobile->is_enabled(), | 1332 public_submodules_->echo_control_mobile->is_enabled(), |
| 1333 config_.residual_echo_detector.enabled, |
| 1313 public_submodules_->noise_suppression->is_enabled(), | 1334 public_submodules_->noise_suppression->is_enabled(), |
| 1314 capture_nonlocked_.intelligibility_enabled, | 1335 capture_nonlocked_.intelligibility_enabled, |
| 1315 capture_nonlocked_.beamformer_enabled, | 1336 capture_nonlocked_.beamformer_enabled, |
| 1316 public_submodules_->gain_control->is_enabled(), | 1337 public_submodules_->gain_control->is_enabled(), |
| 1317 capture_nonlocked_.level_controller_enabled, | 1338 capture_nonlocked_.level_controller_enabled, |
| 1318 public_submodules_->voice_detection->is_enabled(), | 1339 public_submodules_->voice_detection->is_enabled(), |
| 1319 public_submodules_->level_estimator->is_enabled(), | 1340 public_submodules_->level_estimator->is_enabled(), |
| 1320 capture_.transient_suppressor_enabled); | 1341 capture_.transient_suppressor_enabled); |
| 1321 } | 1342 } |
| 1322 | 1343 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1352 render_.render_audio->num_bands(), | 1373 render_.render_audio->num_bands(), |
| 1353 NoiseSuppressionImpl::num_noise_bins())); | 1374 NoiseSuppressionImpl::num_noise_bins())); |
| 1354 } | 1375 } |
| 1355 #endif | 1376 #endif |
| 1356 } | 1377 } |
| 1357 | 1378 |
| 1358 void AudioProcessingImpl::InitializeLevelController() { | 1379 void AudioProcessingImpl::InitializeLevelController() { |
| 1359 private_submodules_->level_controller->Initialize(proc_sample_rate_hz()); | 1380 private_submodules_->level_controller->Initialize(proc_sample_rate_hz()); |
| 1360 } | 1381 } |
| 1361 | 1382 |
| 1383 void AudioProcessingImpl::InitializeResidualEchoDetector() { |
| 1384 public_submodules_->residual_echo_detector->Initialize(proc_sample_rate_hz()); |
| 1385 } |
| 1386 |
| 1362 void AudioProcessingImpl::MaybeUpdateHistograms() { | 1387 void AudioProcessingImpl::MaybeUpdateHistograms() { |
| 1363 static const int kMinDiffDelayMs = 60; | 1388 static const int kMinDiffDelayMs = 60; |
| 1364 | 1389 |
| 1365 if (echo_cancellation()->is_enabled()) { | 1390 if (echo_cancellation()->is_enabled()) { |
| 1366 // Activate delay_jumps_ counters if we know echo_cancellation is runnning. | 1391 // Activate delay_jumps_ counters if we know echo_cancellation is runnning. |
| 1367 // If a stream has echo we know that the echo_cancellation is in process. | 1392 // If a stream has echo we know that the echo_cancellation is in process. |
| 1368 if (capture_.stream_delay_jumps == -1 && | 1393 if (capture_.stream_delay_jumps == -1 && |
| 1369 echo_cancellation()->stream_has_echo()) { | 1394 echo_cancellation()->stream_has_echo()) { |
| 1370 capture_.stream_delay_jumps = 0; | 1395 capture_.stream_delay_jumps = 0; |
| 1371 } | 1396 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 capture_processing_format(kSampleRate16kHz), | 1615 capture_processing_format(kSampleRate16kHz), |
| 1591 split_rate(kSampleRate16kHz) {} | 1616 split_rate(kSampleRate16kHz) {} |
| 1592 | 1617 |
| 1593 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1618 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
| 1594 | 1619 |
| 1595 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1620 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
| 1596 | 1621 |
| 1597 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1622 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
| 1598 | 1623 |
| 1599 } // namespace webrtc | 1624 } // namespace webrtc |
| OLD | NEW |