#include "media/webrtc/helpers.h"
#include "base/logging.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "media/webrtc/webrtc_features.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
namespace {
constexpr webrtc::AudioProcessing::Config kDefaultApmConfig{ … };
webrtc::AudioProcessing::Config CreateApmGetConfig(
const AudioProcessingSettings& settings) { … }
TEST(CreateWebRtcAudioProcessingModuleTest, CheckDefaultAudioProcessingConfig) { … }
TEST(CreateWebRtcAudioProcessingModuleTest,
Agc2ConfigUnchangedIfAgcSettingsDisabled) { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
TEST(CreateWebRtcAudioProcessingModuleTest,
InputVolumeAdjustmentEnabledWithAgc2) { … }
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
TEST(CreateWebRtcAudioProcessingModuleTest,
CanDisableInputVolumeAdjustmentWithAgc2) { … }
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
TEST(CreateWebRtcAudioProcessingModuleTest,
OnlyOneInputVolumeControllerEnabledOnDesktopPlatforms) { … }
#else
TEST(CreateWebRtcAudioProcessingModuleTest,
InputVolumeControllerDisabledOnNonDesktopPlatforms) {
auto config = CreateApmGetConfig(
{.automatic_gain_control = true});
if (!config.gain_controller1.enabled && !config.gain_controller2.enabled) {
GTEST_SUCCEED() << "AGC is altogether disabled.";
}
if (config.gain_controller1.enabled) {
EXPECT_NE(config.gain_controller1.mode,
webrtc::AudioProcessing::Config::GainController1::Mode::
kAdaptiveAnalog);
EXPECT_FALSE(config.gain_controller1.analog_gain_controller.enabled);
}
if (config.gain_controller2.enabled) {
EXPECT_FALSE(config.gain_controller2.input_volume_controller.enabled);
}
}
#endif
TEST(CreateWebRtcAudioProcessingModuleTest, VerifyNoiseSuppressionSettings) { … }
TEST(CreateWebRtcAudioProcessingModuleTest, VerifyEchoCancellerSettings) { … }
TEST(CreateWebRtcAudioProcessingModuleTest, ToggleHighPassFilter) { … }
}
}