message: APM input volume controller tests
  Test behavior with no input volume controller
  Test behavior with startup volume higher than the minimum
  input volume
  Cr-Commit-Position: refs/heads/main@{#38932}
diff: @@ -842,6 +842,47 @@ TEST(ApmWithSubmodulesExcludedTest, ToggleTransientSuppressor) {
  }
  }
  +class StartupInputVolumeParameterizedTest
  + : public ::testing::TestWithParam<int> {};
  +
  +// Tests that, when no input volume controller is used, the startup input volume
  +// is never modified.
  +TEST_P(StartupInputVolumeParameterizedTest,
  + WithNoInputVolumeControllerStartupVolumeNotModified) {
  + webrtc::AudioProcessing::Config config;
  + config.gain_controller1.enabled = false;
  + config.gain_controller2.enabled = false;
  + auto apm = AudioProcessingBuilder().SetConfig(config).Create();
  +
  + int startup_volume = GetParam();
  + int recommended_volume = ProcessInputVolume(
  + *apm, /*num_frames=*/1, /*initial_volume=*/startup_volume);
  + EXPECT_EQ(recommended_volume, startup_volume);
  +}
  +
  +INSTANTIATE_TEST_SUITE_P(AudioProcessingImplTest,
  + StartupInputVolumeParameterizedTest,
  + ::testing::Values(0, 5, 15, 50, 100));
  +
  +// Tests that, when no input volume controller is used, the recommended input
  +// volume always matches the applied one.
  +TEST(AudioProcessingImplTest,
  + WithNoInputVolumeControllerAppliedAndRecommendedVolumesMatch) {
  + webrtc::AudioProcessing::Config config;
  + config.gain_controller1.enabled = false;
  + config.gain_controller2.enabled = false;
  + auto apm = AudioProcessingBuilder().SetConfig(config).Create();
  +
  + Random rand_gen(42);
  + for (int i = 0; i < 32; ++i) {
  + SCOPED_TRACE(i);
  + int32_t applied_volume = rand_gen.Rand(/*low=*/0, /*high=*/255);
  + int recommended_volume =
  + ProcessInputVolume(*apm, /*num_frames=*/1, applied_volume);
  + EXPECT_EQ(recommended_volume, applied_volume);
  + }
  +}
  +
  class ApmInputVolumeControllerParametrizedTest
  : public ::testing::TestWithParam<
  std::tuple<int, int, AudioProcessing::Config>> {
  @@ -916,6 +957,18 @@ TEST_P(ApmInputVolumeControllerParametrizedTest,
  EXPECT_GT(apm->recommended_stream_analog_level(), kManuallyAdjustedVolume);
  }
  +TEST_P(ApmInputVolumeControllerParametrizedTest,
  + DoNotEnforceMinInputVolumeAtStartupWithHighVolume) {
  + const StreamConfig stream_config(sample_rate_hz(), num_channels());
  + auto apm = AudioProcessingBuilder().SetConfig(GetConfig()).Create();
  +
  + constexpr int kStartupVolume = 200;
  + apm->set_stream_analog_level(kStartupVolume);
  + apm->ProcessStream(channel_pointers(), stream_config, stream_config,
  + channel_pointers());
  + EXPECT_EQ(apm->recommended_stream_analog_level(), kStartupVolume);
  +}
  +
  TEST_P(ApmInputVolumeControllerParametrizedTest,
  DoNotEnforceMinInputVolumeAfterManualVolumeAdjustmentToZero) {
  const StreamConfig stream_config(sample_rate_hz(), num_channels());
  