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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 capture_nonlocked_.split_rate = kSampleRate16kHz; | 517 capture_nonlocked_.split_rate = kSampleRate16kHz; |
518 } else { | 518 } else { |
519 capture_nonlocked_.split_rate = | 519 capture_nonlocked_.split_rate = |
520 capture_nonlocked_.fwd_proc_format.sample_rate_hz(); | 520 capture_nonlocked_.fwd_proc_format.sample_rate_hz(); |
521 } | 521 } |
522 | 522 |
523 return InitializeLocked(); | 523 return InitializeLocked(); |
524 } | 524 } |
525 | 525 |
526 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { | 526 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { |
527 AudioProcessing::Config config_to_use = config; | |
528 | |
529 bool config_ok = LevelController::Validate(config_to_use.level_controller); | |
530 if (!config_ok) { | |
531 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl | |
532 << "level_controller: " | |
533 << LevelController::ToString(config_to_use.level_controller) | |
534 << std::endl | |
535 << "Reverting to default parameter set"; | |
536 config_to_use.level_controller = AudioProcessing::Config::LevelController(); | |
537 } | |
538 | |
539 // Run in a single-threaded manner when applying the settings. | 527 // Run in a single-threaded manner when applying the settings. |
540 rtc::CritScope cs_render(&crit_render_); | 528 rtc::CritScope cs_render(&crit_render_); |
541 rtc::CritScope cs_capture(&crit_capture_); | 529 rtc::CritScope cs_capture(&crit_capture_); |
542 | 530 |
| 531 bool config_ok = LevelController::Validate(config.level_controller); |
| 532 if (!config_ok) { |
| 533 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl |
| 534 << "level_controller: " |
| 535 << LevelController::ToString(config.level_controller) |
| 536 << std::endl |
| 537 << "Reverting to default parameter set"; |
| 538 AudioProcessing::Config::LevelController default_config; |
| 539 private_submodules_->level_controller->ApplyConfig(default_config); |
| 540 } else { |
| 541 private_submodules_->level_controller->ApplyConfig(config.level_controller); |
| 542 } |
| 543 |
543 if (config.level_controller.enabled != | 544 if (config.level_controller.enabled != |
544 capture_nonlocked_.level_controller_enabled) { | 545 capture_nonlocked_.level_controller_enabled) { |
545 InitializeLevelController(); | 546 InitializeLevelController(); |
546 LOG(LS_INFO) << "Level controller activated: " | 547 LOG(LS_INFO) << "Level controller activated: " |
547 << capture_nonlocked_.level_controller_enabled; | 548 << capture_nonlocked_.level_controller_enabled; |
548 capture_nonlocked_.level_controller_enabled = | 549 capture_nonlocked_.level_controller_enabled = |
549 config.level_controller.enabled; | 550 config.level_controller.enabled; |
550 } | 551 } |
551 } | 552 } |
552 | 553 |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 fwd_proc_format(kSampleRate16kHz), | 1609 fwd_proc_format(kSampleRate16kHz), |
1609 split_rate(kSampleRate16kHz) {} | 1610 split_rate(kSampleRate16kHz) {} |
1610 | 1611 |
1611 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1612 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1612 | 1613 |
1613 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1614 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
1614 | 1615 |
1615 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1616 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
1616 | 1617 |
1617 } // namespace webrtc | 1618 } // namespace webrtc |
OLD | NEW |