APM: remove min startup volume parameter usage in the APM tests
The parameter is unused and it will be removed in [1]. This CL isolates the necessary unit test changes from [1]. [1] https://webrtc-review.googlesource.com/c/src/+/278787 Bug: webrtc:7494 Change-Id: Ic1179d335926fba8ff1b65b494b538cf849724bb Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279100 Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38416}
This commit is contained in:
parent
baf5c9fabd
commit
9ea538185a
@ -132,17 +132,15 @@ class TestRenderPreProcessor : public CustomProcessing {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Creates a simple `AudioProcessing` instance for APM input volume testing
|
// Creates a simple `AudioProcessing` instance for APM input volume testing
|
||||||
// with analog and digital AGC enabled and minimum volume `startup_min_volume`
|
// with analog and digital AGC enabled.
|
||||||
// at the startup.
|
rtc::scoped_refptr<AudioProcessing> CreateApmForInputVolumeTest() {
|
||||||
rtc::scoped_refptr<AudioProcessing> CreateApmForInputVolumeTest(
|
|
||||||
int startup_min_volume) {
|
|
||||||
webrtc::AudioProcessing::Config config;
|
webrtc::AudioProcessing::Config config;
|
||||||
// Enable AGC1 analog.
|
// Enable AGC1 analog.
|
||||||
config.gain_controller1.enabled = true;
|
config.gain_controller1.enabled = true;
|
||||||
config.gain_controller1.analog_gain_controller.enabled = true;
|
config.gain_controller1.analog_gain_controller.enabled = true;
|
||||||
config.gain_controller1.analog_gain_controller.startup_min_volume =
|
// Enable AGC2 adaptive digital.
|
||||||
startup_min_volume;
|
config.gain_controller1.analog_gain_controller.enable_digital_adaptive =
|
||||||
// Enable AGC2 digital.
|
false;
|
||||||
config.gain_controller2.enabled = true;
|
config.gain_controller2.enabled = true;
|
||||||
config.gain_controller2.adaptive_digital.enabled = true;
|
config.gain_controller2.adaptive_digital.enabled = true;
|
||||||
|
|
||||||
@ -197,16 +195,14 @@ std::string GetMinMicLevelExperimentFieldTrial(absl::optional<int> value) {
|
|||||||
// TODO(webrtc:7494): Remove the fieldtrial from the input volume tests when
|
// TODO(webrtc:7494): Remove the fieldtrial from the input volume tests when
|
||||||
// "WebRTC-Audio-2ndAgcMinMicLevelExperiment" is removed.
|
// "WebRTC-Audio-2ndAgcMinMicLevelExperiment" is removed.
|
||||||
class InputVolumeStartupParameterizedTest
|
class InputVolumeStartupParameterizedTest
|
||||||
: public ::testing::TestWithParam<
|
: public ::testing::TestWithParam<std::tuple<int, absl::optional<int>>> {
|
||||||
std::tuple<int, int, absl::optional<int>>> {
|
|
||||||
protected:
|
protected:
|
||||||
InputVolumeStartupParameterizedTest()
|
InputVolumeStartupParameterizedTest()
|
||||||
: field_trials_(
|
: field_trials_(
|
||||||
GetMinMicLevelExperimentFieldTrial(std::get<2>(GetParam()))) {}
|
GetMinMicLevelExperimentFieldTrial(std::get<1>(GetParam()))) {}
|
||||||
int GetMinStartupVolume() const { return std::get<0>(GetParam()); }
|
int GetStartupVolume() const { return std::get<0>(GetParam()); }
|
||||||
int GetStartupVolume() const { return std::get<1>(GetParam()); }
|
|
||||||
int GetMinVolume() const {
|
int GetMinVolume() const {
|
||||||
return std::get<2>(GetParam()).value_or(kMinInputVolume);
|
return std::get<1>(GetParam()).value_or(kMinInputVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -938,11 +934,9 @@ TEST(ApmWithSubmodulesExcludedTest, ToggleTransientSuppressor) {
|
|||||||
TEST_P(InputVolumeStartupParameterizedTest,
|
TEST_P(InputVolumeStartupParameterizedTest,
|
||||||
VerifyStartupMinVolumeAppliedAtStartup) {
|
VerifyStartupMinVolumeAppliedAtStartup) {
|
||||||
const int applied_startup_input_volume = GetStartupVolume();
|
const int applied_startup_input_volume = GetStartupVolume();
|
||||||
const int startup_min_volume = GetMinStartupVolume();
|
|
||||||
const int min_volume = std::max(startup_min_volume, GetMinVolume());
|
|
||||||
const int expected_volume =
|
const int expected_volume =
|
||||||
std::max(applied_startup_input_volume, min_volume);
|
std::max(applied_startup_input_volume, GetMinVolume());
|
||||||
auto apm(CreateApmForInputVolumeTest(startup_min_volume));
|
auto apm = CreateApmForInputVolumeTest();
|
||||||
|
|
||||||
const int recommended_input_volume =
|
const int recommended_input_volume =
|
||||||
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
||||||
@ -955,11 +949,10 @@ TEST_P(InputVolumeStartupParameterizedTest,
|
|||||||
// "WebRTC-Audio-2ndAgcMinMicLevelExperiment" is enabled.
|
// "WebRTC-Audio-2ndAgcMinMicLevelExperiment" is enabled.
|
||||||
TEST_P(InputVolumeNotZeroParameterizedTest,
|
TEST_P(InputVolumeNotZeroParameterizedTest,
|
||||||
VerifyMinVolumeMaybeAppliedAfterManualVolumeAdjustments) {
|
VerifyMinVolumeMaybeAppliedAfterManualVolumeAdjustments) {
|
||||||
constexpr int kStartupMinVolume = 0;
|
|
||||||
const int applied_startup_input_volume = GetStartupVolume();
|
const int applied_startup_input_volume = GetStartupVolume();
|
||||||
const int applied_input_volume = GetVolume();
|
const int applied_input_volume = GetVolume();
|
||||||
const int expected_volume = std::max(applied_input_volume, GetMinVolume());
|
const int expected_volume = std::max(applied_input_volume, GetMinVolume());
|
||||||
auto apm(CreateApmForInputVolumeTest(kStartupMinVolume));
|
auto apm = CreateApmForInputVolumeTest();
|
||||||
|
|
||||||
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
||||||
const int recommended_input_volume =
|
const int recommended_input_volume =
|
||||||
@ -977,10 +970,9 @@ TEST_P(InputVolumeNotZeroParameterizedTest,
|
|||||||
// adjusted to zero.
|
// adjusted to zero.
|
||||||
TEST_P(InputVolumeZeroParameterizedTest,
|
TEST_P(InputVolumeZeroParameterizedTest,
|
||||||
VerifyMinVolumeNotAppliedAfterManualVolumeAdjustments) {
|
VerifyMinVolumeNotAppliedAfterManualVolumeAdjustments) {
|
||||||
constexpr int kStartupMinVolume = 0;
|
|
||||||
constexpr int kZeroVolume = 0;
|
constexpr int kZeroVolume = 0;
|
||||||
const int applied_startup_input_volume = GetStartupVolume();
|
const int applied_startup_input_volume = GetStartupVolume();
|
||||||
auto apm(CreateApmForInputVolumeTest(kStartupMinVolume));
|
auto apm = CreateApmForInputVolumeTest();
|
||||||
|
|
||||||
const int recommended_input_volume_after_startup =
|
const int recommended_input_volume_after_startup =
|
||||||
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
||||||
@ -995,10 +987,9 @@ TEST_P(InputVolumeZeroParameterizedTest,
|
|||||||
// before it is automatically adjusted.
|
// before it is automatically adjusted.
|
||||||
TEST_P(InputVolumeNotZeroParameterizedTest,
|
TEST_P(InputVolumeNotZeroParameterizedTest,
|
||||||
VerifyMinVolumeAppliedAfterAutomaticVolumeAdjustments) {
|
VerifyMinVolumeAppliedAfterAutomaticVolumeAdjustments) {
|
||||||
constexpr int kStartupMinVolume = 0;
|
|
||||||
const int applied_startup_input_volume = GetStartupVolume();
|
const int applied_startup_input_volume = GetStartupVolume();
|
||||||
const int applied_input_volume = GetVolume();
|
const int applied_input_volume = GetVolume();
|
||||||
auto apm(CreateApmForInputVolumeTest(kStartupMinVolume));
|
auto apm = CreateApmForInputVolumeTest();
|
||||||
|
|
||||||
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
||||||
const int recommended_input_volume =
|
const int recommended_input_volume =
|
||||||
@ -1014,10 +1005,9 @@ TEST_P(InputVolumeNotZeroParameterizedTest,
|
|||||||
// before it is automatically adjusted.
|
// before it is automatically adjusted.
|
||||||
TEST_P(InputVolumeZeroParameterizedTest,
|
TEST_P(InputVolumeZeroParameterizedTest,
|
||||||
VerifyMinVolumeNotAppliedAfterAutomaticVolumeAdjustments) {
|
VerifyMinVolumeNotAppliedAfterAutomaticVolumeAdjustments) {
|
||||||
constexpr int kStartupMinVolume = 0;
|
|
||||||
constexpr int kZeroVolume = 0;
|
constexpr int kZeroVolume = 0;
|
||||||
const int applied_startup_input_volume = GetStartupVolume();
|
const int applied_startup_input_volume = GetStartupVolume();
|
||||||
auto apm(CreateApmForInputVolumeTest(kStartupMinVolume));
|
auto apm = CreateApmForInputVolumeTest();
|
||||||
|
|
||||||
const int recommended_input_volume_after_startup =
|
const int recommended_input_volume_after_startup =
|
||||||
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
ProcessInputVolume(*apm, /*num_frames=*/1, applied_startup_input_volume);
|
||||||
@ -1030,8 +1020,7 @@ TEST_P(InputVolumeZeroParameterizedTest,
|
|||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(AudioProcessingImplTest,
|
INSTANTIATE_TEST_SUITE_P(AudioProcessingImplTest,
|
||||||
InputVolumeStartupParameterizedTest,
|
InputVolumeStartupParameterizedTest,
|
||||||
::testing::Combine(::testing::Values(0, 5, 15),
|
::testing::Combine(::testing::Values(0, 5, 30),
|
||||||
::testing::Values(0, 5, 30),
|
|
||||||
::testing::Values(absl::nullopt,
|
::testing::Values(absl::nullopt,
|
||||||
20)));
|
20)));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user