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 23 matching lines...) Expand all Loading... |
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/low_cut_filter.h" | 37 #include "webrtc/modules/audio_processing/low_cut_filter.h" |
38 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" | 38 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" |
39 #include "webrtc/modules/audio_processing/residual_echo_detector.h" | 39 #include "webrtc/modules/audio_processing/residual_echo_detector.h" |
40 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" | 40 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" |
41 #include "webrtc/modules/audio_processing/voice_detection_impl.h" | 41 #include "webrtc/modules/audio_processing/voice_detection_impl.h" |
42 #include "webrtc/modules/include/module_common_types.h" | 42 #include "webrtc/modules/include/module_common_types.h" |
43 #include "webrtc/system_wrappers/include/file_wrapper.h" | 43 #include "webrtc/system_wrappers/include/file_wrapper.h" |
44 #include "webrtc/system_wrappers/include/logging.h" | |
45 #include "webrtc/system_wrappers/include/metrics.h" | 44 #include "webrtc/system_wrappers/include/metrics.h" |
46 | 45 |
47 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 46 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
48 // Files generated at build-time by the protobuf compiler. | 47 // Files generated at build-time by the protobuf compiler. |
49 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 48 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
50 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" | 49 #include "external/webrtc/webrtc/modules/audio_processing/debug.pb.h" |
51 #else | 50 #else |
52 #include "webrtc/modules/audio_processing/debug.pb.h" | 51 #include "webrtc/modules/audio_processing/debug.pb.h" |
53 #endif | 52 #endif |
54 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 53 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } | 598 } |
600 | 599 |
601 return InitializeLocked(); | 600 return InitializeLocked(); |
602 } | 601 } |
603 | 602 |
604 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { | 603 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { |
605 config_ = config; | 604 config_ = config; |
606 | 605 |
607 bool config_ok = LevelController::Validate(config_.level_controller); | 606 bool config_ok = LevelController::Validate(config_.level_controller); |
608 if (!config_ok) { | 607 if (!config_ok) { |
609 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl | |
610 << "level_controller: " | |
611 << LevelController::ToString(config_.level_controller) | |
612 << std::endl | |
613 << "Reverting to default parameter set"; | |
614 config_.level_controller = AudioProcessing::Config::LevelController(); | 608 config_.level_controller = AudioProcessing::Config::LevelController(); |
615 } | 609 } |
616 | 610 |
617 // Run in a single-threaded manner when applying the settings. | 611 // Run in a single-threaded manner when applying the settings. |
618 rtc::CritScope cs_render(&crit_render_); | 612 rtc::CritScope cs_render(&crit_render_); |
619 rtc::CritScope cs_capture(&crit_capture_); | 613 rtc::CritScope cs_capture(&crit_capture_); |
620 | 614 |
621 // TODO(peah): Replace the use of capture_nonlocked_.level_controller_enabled | 615 // TODO(peah): Replace the use of capture_nonlocked_.level_controller_enabled |
622 // with the value in config_ everywhere in the code. | 616 // with the value in config_ everywhere in the code. |
623 if (capture_nonlocked_.level_controller_enabled != | 617 if (capture_nonlocked_.level_controller_enabled != |
624 config_.level_controller.enabled) { | 618 config_.level_controller.enabled) { |
625 capture_nonlocked_.level_controller_enabled = | 619 capture_nonlocked_.level_controller_enabled = |
626 config_.level_controller.enabled; | 620 config_.level_controller.enabled; |
627 // TODO(peah): Remove the conditional initialization to always initialize | 621 // TODO(peah): Remove the conditional initialization to always initialize |
628 // the level controller regardless of whether it is enabled or not. | 622 // the level controller regardless of whether it is enabled or not. |
629 InitializeLevelController(); | 623 InitializeLevelController(); |
630 } | 624 } |
631 LOG(LS_INFO) << "Level controller activated: " | |
632 << capture_nonlocked_.level_controller_enabled; | |
633 | 625 |
634 private_submodules_->level_controller->ApplyConfig(config_.level_controller); | 626 private_submodules_->level_controller->ApplyConfig(config_.level_controller); |
635 | 627 |
636 InitializeLowCutFilter(); | 628 InitializeLowCutFilter(); |
637 | 629 |
638 LOG(LS_INFO) << "Highpass filter activated: " | |
639 << config_.high_pass_filter.enabled; | |
640 | |
641 config_ok = EchoCanceller3::Validate(config_.echo_canceller3); | 630 config_ok = EchoCanceller3::Validate(config_.echo_canceller3); |
642 if (!config_ok) { | 631 if (!config_ok) { |
643 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl | |
644 << "echo canceller 3: " | |
645 << EchoCanceller3::ToString(config_.echo_canceller3) | |
646 << std::endl | |
647 << "Reverting to default parameter set"; | |
648 config_.echo_canceller3 = AudioProcessing::Config::EchoCanceller3(); | 632 config_.echo_canceller3 = AudioProcessing::Config::EchoCanceller3(); |
649 } | 633 } |
650 | 634 |
651 if (config.echo_canceller3.enabled != | 635 if (config.echo_canceller3.enabled != |
652 capture_nonlocked_.echo_canceller3_enabled) { | 636 capture_nonlocked_.echo_canceller3_enabled) { |
653 capture_nonlocked_.echo_canceller3_enabled = | 637 capture_nonlocked_.echo_canceller3_enabled = |
654 config_.echo_canceller3.enabled; | 638 config_.echo_canceller3.enabled; |
655 InitializeEchoCanceller3(); | 639 InitializeEchoCanceller3(); |
656 LOG(LS_INFO) << "Echo canceller 3 activated: " | |
657 << capture_nonlocked_.echo_canceller3_enabled; | |
658 } | 640 } |
659 } | 641 } |
660 | 642 |
661 void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { | 643 void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { |
662 // Run in a single-threaded manner when setting the extra options. | 644 // Run in a single-threaded manner when setting the extra options. |
663 rtc::CritScope cs_render(&crit_render_); | 645 rtc::CritScope cs_render(&crit_render_); |
664 rtc::CritScope cs_capture(&crit_capture_); | 646 rtc::CritScope cs_capture(&crit_capture_); |
665 | 647 |
666 public_submodules_->echo_cancellation->SetExtraOptions(config); | 648 public_submodules_->echo_cancellation->SetExtraOptions(config); |
667 | 649 |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 capture_processing_format(kSampleRate16kHz), | 1971 capture_processing_format(kSampleRate16kHz), |
1990 split_rate(kSampleRate16kHz) {} | 1972 split_rate(kSampleRate16kHz) {} |
1991 | 1973 |
1992 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1974 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1993 | 1975 |
1994 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1976 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
1995 | 1977 |
1996 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1978 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
1997 | 1979 |
1998 } // namespace webrtc | 1980 } // namespace webrtc |
OLD | NEW |