Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(843)

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2337083002: Reland of added functionality for specifying the initial signal level to use for the gain estimation (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 capture_nonlocked_.split_rate = kSampleRate16kHz; 523 capture_nonlocked_.split_rate = kSampleRate16kHz;
524 } else { 524 } else {
525 capture_nonlocked_.split_rate = 525 capture_nonlocked_.split_rate =
526 capture_nonlocked_.fwd_proc_format.sample_rate_hz(); 526 capture_nonlocked_.fwd_proc_format.sample_rate_hz();
527 } 527 }
528 528
529 return InitializeLocked(); 529 return InitializeLocked();
530 } 530 }
531 531
532 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { 532 void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
533 AudioProcessing::Config config_to_use = config;
534
535 bool config_ok = LevelController::Validate(config_to_use.level_controller);
536 if (!config_ok) {
537 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl
538 << "level_controller: "
539 << LevelController::ToString(config_to_use.level_controller)
540 << std::endl
541 << "Reverting to default parameter set";
542 config_to_use.level_controller = AudioProcessing::Config::LevelController();
543 }
544
545 // Run in a single-threaded manner when applying the settings. 533 // Run in a single-threaded manner when applying the settings.
546 rtc::CritScope cs_render(&crit_render_); 534 rtc::CritScope cs_render(&crit_render_);
547 rtc::CritScope cs_capture(&crit_capture_); 535 rtc::CritScope cs_capture(&crit_capture_);
548 536
537 bool config_ok = LevelController::Validate(config.level_controller);
538 if (!config_ok) {
539 LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl
540 << "level_controller: "
541 << LevelController::ToString(config.level_controller)
542 << std::endl
543 << "Reverting to default parameter set";
544 AudioProcessing::Config::LevelController default_config;
545 private_submodules_->level_controller->ApplyConfig(default_config);
546 } else {
547 private_submodules_->level_controller->ApplyConfig(config.level_controller);
548 }
the sun 2016/09/14 10:00:59 Why change the previous code? You could just have
the sun 2016/09/14 17:02:15 If I'm not mistaken about that, it seems there's o
hlundin-webrtc 2016/09/15 07:50:17 +1 on all of the above.
peah-webrtc 2016/09/16 07:11:06 Acknowledged.
peah-webrtc 2016/09/16 07:11:06 Very, very likely. What I guess you mean is to che
peah-webrtc 2016/09/16 07:11:06 The reason for moving the critscopes is that 1) p
the sun 2016/09/16 08:00:40 Yes, so figure out the config state before taking
the sun 2016/09/16 08:00:40 Yes, something like that - figure out a test to tr
hlundin-webrtc 2016/09/16 08:17:16 Acknowledged.
peah-webrtc 2016/09/16 11:36:04 I really like rainbows and fluffy clouds! I'll inc
peah-webrtc 2016/09/16 11:36:04 Acknowledged.
549
549 if (config.level_controller.enabled != 550 if (config.level_controller.enabled !=
550 capture_nonlocked_.level_controller_enabled) { 551 capture_nonlocked_.level_controller_enabled) {
551 InitializeLevelController(); 552 InitializeLevelController();
552 LOG(LS_INFO) << "Level controller activated: " 553 LOG(LS_INFO) << "Level controller activated: "
553 << capture_nonlocked_.level_controller_enabled; 554 << capture_nonlocked_.level_controller_enabled;
554 capture_nonlocked_.level_controller_enabled = 555 capture_nonlocked_.level_controller_enabled =
555 config.level_controller.enabled; 556 config.level_controller.enabled;
556 } 557 }
557 } 558 }
558 559
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 fwd_proc_format(kSampleRate16kHz), 1615 fwd_proc_format(kSampleRate16kHz),
1615 split_rate(kSampleRate16kHz) {} 1616 split_rate(kSampleRate16kHz) {}
1616 1617
1617 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 1618 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
1618 1619
1619 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 1620 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
1620 1621
1621 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 1622 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
1622 1623
1623 } // namespace webrtc 1624 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698