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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 public_submodules_->level_estimator.reset( | 291 public_submodules_->level_estimator.reset( |
292 new LevelEstimatorImpl(&crit_capture_)); | 292 new LevelEstimatorImpl(&crit_capture_)); |
293 public_submodules_->noise_suppression.reset( | 293 public_submodules_->noise_suppression.reset( |
294 new NoiseSuppressionImpl(&crit_capture_)); | 294 new NoiseSuppressionImpl(&crit_capture_)); |
295 public_submodules_->voice_detection.reset( | 295 public_submodules_->voice_detection.reset( |
296 new VoiceDetectionImpl(&crit_capture_)); | 296 new VoiceDetectionImpl(&crit_capture_)); |
297 public_submodules_->gain_control_for_experimental_agc.reset( | 297 public_submodules_->gain_control_for_experimental_agc.reset( |
298 new GainControlForExperimentalAgc( | 298 new GainControlForExperimentalAgc( |
299 public_submodules_->gain_control.get(), &crit_capture_)); | 299 public_submodules_->gain_control.get(), &crit_capture_)); |
300 | 300 |
301 // TODO(peah): Move this creation to happen only when the level controller | |
302 // is enabled. | |
301 private_submodules_->level_controller.reset(new LevelController()); | 303 private_submodules_->level_controller.reset(new LevelController()); |
302 } | 304 } |
303 | 305 |
304 SetExtraOptions(config); | 306 SetExtraOptions(config); |
305 } | 307 } |
306 | 308 |
307 AudioProcessingImpl::~AudioProcessingImpl() { | 309 AudioProcessingImpl::~AudioProcessingImpl() { |
308 // Depends on gain_control_ and | 310 // Depends on gain_control_ and |
309 // public_submodules_->gain_control_for_experimental_agc. | 311 // public_submodules_->gain_control_for_experimental_agc. |
310 private_submodules_->agc_manager.reset(); | 312 private_submodules_->agc_manager.reset(); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
517 capture_nonlocked_.split_rate = kSampleRate16kHz; | 519 capture_nonlocked_.split_rate = kSampleRate16kHz; |
518 } else { | 520 } else { |
519 capture_nonlocked_.split_rate = | 521 capture_nonlocked_.split_rate = |
520 capture_nonlocked_.fwd_proc_format.sample_rate_hz(); | 522 capture_nonlocked_.fwd_proc_format.sample_rate_hz(); |
521 } | 523 } |
522 | 524 |
523 return InitializeLocked(); | 525 return InitializeLocked(); |
524 } | 526 } |
525 | 527 |
526 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { | 528 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { |
527 AudioProcessing::Config config_to_use = config; | 529 config_ = config; |
528 | 530 |
529 bool config_ok = LevelController::Validate(config_to_use.level_controller); | 531 bool config_ok = LevelController::Validate(config_.level_controller); |
530 if (!config_ok) { | 532 if (!config_ok) { |
531 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl | 533 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl |
532 << "level_controller: " | 534 << "level_controller: " |
533 << LevelController::ToString(config_to_use.level_controller) | 535 << LevelController::ToString(config.level_controller) |
the sun
2016/09/30 08:51:16
use config_
peah-webrtc
2016/10/03 09:52:13
Done.
hlundin-webrtc
2016/10/05 12:29:18
To be precise, you are now using config, not confi
peah-webrtc
2016/10/06 06:27:27
In the latest patchset, this is now changed to con
| |
534 << std::endl | 536 << std::endl |
535 << "Reverting to default parameter set"; | 537 << "Reverting to default parameter set"; |
536 config_to_use.level_controller = AudioProcessing::Config::LevelController(); | 538 config_.level_controller = AudioProcessing::Config::LevelController(); |
537 } | 539 } |
538 | 540 |
539 // Run in a single-threaded manner when applying the settings. | 541 // Run in a single-threaded manner when applying the settings. |
540 rtc::CritScope cs_render(&crit_render_); | 542 rtc::CritScope cs_render(&crit_render_); |
541 rtc::CritScope cs_capture(&crit_capture_); | 543 rtc::CritScope cs_capture(&crit_capture_); |
542 | 544 |
543 if (config.level_controller.enabled != | 545 // TODO(peah): Replace the use of capture_nonlocked_.level_controller_enabled |
544 capture_nonlocked_.level_controller_enabled) { | 546 // with the value in config_ everywhere in the code. |
547 if (capture_nonlocked_.level_controller_enabled != | |
548 config_.level_controller.enabled) { | |
549 capture_nonlocked_.level_controller_enabled = | |
550 config_.level_controller.enabled; | |
551 // TODO(peah): Remove the conditional initialization to always initialize | |
552 // the level controller regardless of whether it is enabled or not. | |
545 InitializeLevelController(); | 553 InitializeLevelController(); |
554 // TODO(peah): Add logline regardless of whether this is enabled or not. | |
546 LOG(LS_INFO) << "Level controller activated: " | 555 LOG(LS_INFO) << "Level controller activated: " |
547 << capture_nonlocked_.level_controller_enabled; | 556 << capture_nonlocked_.level_controller_enabled; |
548 capture_nonlocked_.level_controller_enabled = | |
549 config.level_controller.enabled; | |
550 } | 557 } |
558 | |
559 private_submodules_->level_controller->ApplyConfig(config_.level_controller); | |
551 } | 560 } |
552 | 561 |
553 void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { | 562 void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { |
554 // Run in a single-threaded manner when setting the extra options. | 563 // Run in a single-threaded manner when setting the extra options. |
555 rtc::CritScope cs_render(&crit_render_); | 564 rtc::CritScope cs_render(&crit_render_); |
556 rtc::CritScope cs_capture(&crit_capture_); | 565 rtc::CritScope cs_capture(&crit_capture_); |
557 | 566 |
558 public_submodules_->echo_cancellation->SetExtraOptions(config); | 567 public_submodules_->echo_cancellation->SetExtraOptions(config); |
559 | 568 |
560 if (capture_.transient_suppressor_enabled != | 569 if (capture_.transient_suppressor_enabled != |
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1608 fwd_proc_format(kSampleRate16kHz), | 1617 fwd_proc_format(kSampleRate16kHz), |
1609 split_rate(kSampleRate16kHz) {} | 1618 split_rate(kSampleRate16kHz) {} |
1610 | 1619 |
1611 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1620 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1612 | 1621 |
1613 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1622 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
1614 | 1623 |
1615 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1624 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
1616 | 1625 |
1617 } // namespace webrtc | 1626 } // namespace webrtc |
OLD | NEW |