Deprecate the adaptive level controller

Level control handled by default-on AGC.

Bug: none
Change-Id: I405daeceece12c896d41156b649fcfd556726f77
Reviewed-on: https://webrtc-review.googlesource.com/59682
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Alex Loiko <aleloi@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22305}
This commit is contained in:
Sam Zackrisson
2018-03-05 15:59:06 +01:00
committed by Commit Bot
parent 9771c5050d
commit 6f37ed78d9
39 changed files with 11 additions and 2288 deletions

View File

@ -25,7 +25,6 @@
#include "modules/audio_processing/common.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "modules/audio_processing/include/mock_audio_processing.h"
#include "modules/audio_processing/level_controller/level_controller_constants.h"
#include "modules/audio_processing/test/protobuf_utils.h"
#include "modules/audio_processing/test/test_utils.h"
#include "modules/include/module_common_types.h"
@ -2821,98 +2820,6 @@ INSTANTIATE_TEST_CASE_P(
} // namespace
TEST(ApmConfiguration, DefaultBehavior) {
// Verify that the level controller is default off, it can be activated using
// the config, and that the default initial level is maintained after the
// config has been applied.
std::unique_ptr<AudioProcessingImpl> apm(
new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
AudioProcessing::Config config;
EXPECT_FALSE(apm->config_.level_controller.enabled);
// TODO(peah): Add test for the existence of the level controller object once
// that is created only when that is specified in the config.
// TODO(peah): Remove the testing for
// apm->capture_nonlocked_.level_controller_enabled once the value in config_
// is instead used to activate the level controller.
EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled);
EXPECT_NEAR(kTargetLcPeakLeveldBFS,
apm->config_.level_controller.initial_peak_level_dbfs,
std::numeric_limits<float>::epsilon());
config.level_controller.enabled = true;
apm->ApplyConfig(config);
EXPECT_TRUE(apm->config_.level_controller.enabled);
// TODO(peah): Add test for the existence of the level controller object once
// that is created only when the that is specified in the config.
// TODO(peah): Remove the testing for
// apm->capture_nonlocked_.level_controller_enabled once the value in config_
// is instead used to activate the level controller.
EXPECT_TRUE(apm->capture_nonlocked_.level_controller_enabled);
EXPECT_NEAR(kTargetLcPeakLeveldBFS,
apm->config_.level_controller.initial_peak_level_dbfs,
std::numeric_limits<float>::epsilon());
}
TEST(ApmConfiguration, ValidConfigBehavior) {
// Verify that the initial level can be specified and is retained after the
// config has been applied.
std::unique_ptr<AudioProcessingImpl> apm(
new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
AudioProcessing::Config config;
config.level_controller.initial_peak_level_dbfs = -50.f;
apm->ApplyConfig(config);
EXPECT_FALSE(apm->config_.level_controller.enabled);
// TODO(peah): Add test for the existence of the level controller object once
// that is created only when the that is specified in the config.
// TODO(peah): Remove the testing for
// apm->capture_nonlocked_.level_controller_enabled once the value in config_
// is instead used to activate the level controller.
EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled);
EXPECT_NEAR(-50.f, apm->config_.level_controller.initial_peak_level_dbfs,
std::numeric_limits<float>::epsilon());
}
TEST(ApmConfiguration, InValidConfigBehavior) {
// Verify that the config is properly reset when nonproper values are applied
// for the initial level.
// Verify that the config is properly reset when the specified initial peak
// level is too low.
std::unique_ptr<AudioProcessingImpl> apm(
new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
AudioProcessing::Config config;
config.level_controller.enabled = true;
config.level_controller.initial_peak_level_dbfs = -101.f;
apm->ApplyConfig(config);
EXPECT_FALSE(apm->config_.level_controller.enabled);
// TODO(peah): Add test for the existence of the level controller object once
// that is created only when the that is specified in the config.
// TODO(peah): Remove the testing for
// apm->capture_nonlocked_.level_controller_enabled once the value in config_
// is instead used to activate the level controller.
EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled);
EXPECT_NEAR(kTargetLcPeakLeveldBFS,
apm->config_.level_controller.initial_peak_level_dbfs,
std::numeric_limits<float>::epsilon());
// Verify that the config is properly reset when the specified initial peak
// level is too high.
apm.reset(new rtc::RefCountedObject<AudioProcessingImpl>(webrtc::Config()));
config = AudioProcessing::Config();
config.level_controller.enabled = true;
config.level_controller.initial_peak_level_dbfs = 1.f;
apm->ApplyConfig(config);
EXPECT_FALSE(apm->config_.level_controller.enabled);
// TODO(peah): Add test for the existence of the level controller object once
// that is created only when that is specified in the config.
// TODO(peah): Remove the testing for
// apm->capture_nonlocked_.level_controller_enabled once the value in config_
// is instead used to activate the level controller.
EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled);
EXPECT_NEAR(kTargetLcPeakLeveldBFS,
apm->config_.level_controller.initial_peak_level_dbfs,
std::numeric_limits<float>::epsilon());
}
TEST(ApmConfiguration, EnablePostProcessing) {
// Verify that apm uses a capture post processing module if one is provided.
webrtc::Config webrtc_config;
@ -3007,7 +2914,6 @@ std::unique_ptr<AudioProcessing> CreateApm(bool use_AEC2) {
config.residual_echo_detector.enabled = true;
config.high_pass_filter.enabled = false;
config.gain_controller2.enabled = false;
config.level_controller.enabled = false;
apm->ApplyConfig(config);
EXPECT_EQ(apm->gain_control()->Enable(false), 0);
EXPECT_EQ(apm->level_estimator()->Enable(false), 0);