ExperimentalNs
removed + APM not depending anymore on webrtc::Config
Thanks to the elimination of `ExperimentalNs`, there is no need anymore to pass `webrtc::Config` to build APM. Hence, `AudioProcessingBuilder::Create(const webrtc::Config&)` is also removed. Bug: webrtc:5298 Change-Id: I0a3482376a7753434486fe564681f7b9f83939c5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232128 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35025}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
25b5e08094
commit
be1b8989d1
@ -587,14 +587,15 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
||||
if (options.experimental_ns) {
|
||||
experimental_ns_ = options.experimental_ns;
|
||||
}
|
||||
if (experimental_ns_) {
|
||||
RTC_LOG(LS_INFO) << "Experimental ns is enabled? " << *experimental_ns_;
|
||||
config.Set<webrtc::ExperimentalNs>(
|
||||
new webrtc::ExperimentalNs(*experimental_ns_));
|
||||
}
|
||||
|
||||
webrtc::AudioProcessing::Config apm_config = ap->GetConfig();
|
||||
|
||||
#if !(defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
|
||||
if (experimental_ns_.has_value()) {
|
||||
apm_config.transient_suppression.enabled = experimental_ns_.value();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (options.echo_cancellation) {
|
||||
apm_config.echo_canceller.enabled = *options.echo_cancellation;
|
||||
apm_config.echo_canceller.mobile_mode = use_mobile_software_aec;
|
||||
|
@ -24,9 +24,8 @@ using ::testing::StrictMock;
|
||||
|
||||
namespace {
|
||||
rtc::scoped_refptr<webrtc::AudioProcessing> CreateAudioProcessing() {
|
||||
webrtc::Config config;
|
||||
rtc::scoped_refptr<webrtc::AudioProcessing> apm(
|
||||
webrtc::AudioProcessingBuilderForTesting().Create(config));
|
||||
webrtc::AudioProcessingBuilderForTesting().Create());
|
||||
RTC_DCHECK(apm);
|
||||
return apm;
|
||||
}
|
||||
|
@ -21,25 +21,14 @@ AudioProcessingBuilder::AudioProcessingBuilder() = default;
|
||||
AudioProcessingBuilder::~AudioProcessingBuilder() = default;
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilder::Create() {
|
||||
webrtc::Config config;
|
||||
return Create(config);
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilder::Create(
|
||||
const webrtc::Config& config) {
|
||||
#ifdef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
|
||||
|
||||
// Implementation returning a null pointer for using when the APM is excluded
|
||||
// from the build..
|
||||
// Return a null pointer when the APM is excluded from the build.
|
||||
return nullptr;
|
||||
|
||||
#else
|
||||
|
||||
// Standard implementation.
|
||||
#else // WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
|
||||
return rtc::make_ref_counted<AudioProcessingImpl>(
|
||||
config, std::move(capture_post_processing_),
|
||||
std::move(render_pre_processing_), std::move(echo_control_factory_),
|
||||
std::move(echo_detector_), std::move(capture_analyzer_));
|
||||
std::move(capture_post_processing_), std::move(render_pre_processing_),
|
||||
std::move(echo_control_factory_), std::move(echo_detector_),
|
||||
std::move(capture_analyzer_));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -234,9 +234,8 @@ bool AudioProcessingImpl::SubmoduleStates::HighPassFilteringRequired() const {
|
||||
noise_suppressor_enabled_;
|
||||
}
|
||||
|
||||
AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config)
|
||||
: AudioProcessingImpl(config,
|
||||
/*capture_post_processor=*/nullptr,
|
||||
AudioProcessingImpl::AudioProcessingImpl()
|
||||
: AudioProcessingImpl(/*capture_post_processor=*/nullptr,
|
||||
/*render_pre_processor=*/nullptr,
|
||||
/*echo_control_factory=*/nullptr,
|
||||
/*echo_detector=*/nullptr,
|
||||
@ -245,7 +244,6 @@ AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config)
|
||||
int AudioProcessingImpl::instance_count_ = 0;
|
||||
|
||||
AudioProcessingImpl::AudioProcessingImpl(
|
||||
const webrtc::Config& config,
|
||||
std::unique_ptr<CustomProcessing> capture_post_processor,
|
||||
std::unique_ptr<CustomProcessing> render_pre_processor,
|
||||
std::unique_ptr<EchoControlFactory> echo_control_factory,
|
||||
@ -300,12 +298,6 @@ AudioProcessingImpl::AudioProcessingImpl(
|
||||
submodules_.echo_detector = rtc::make_ref_counted<ResidualEchoDetector>();
|
||||
}
|
||||
|
||||
#if !(defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
|
||||
// TODO(webrtc:5298): Remove once the use of ExperimentalNs has been
|
||||
// deprecated.
|
||||
config_.transient_suppression.enabled = config.Get<ExperimentalNs>().enabled;
|
||||
#endif
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,9 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
public:
|
||||
// Methods forcing APM to run in a single-threaded manner.
|
||||
// Acquires both the render and capture locks.
|
||||
explicit AudioProcessingImpl(const webrtc::Config& config);
|
||||
AudioProcessingImpl();
|
||||
// AudioProcessingImpl takes ownership of capture post processor.
|
||||
AudioProcessingImpl(const webrtc::Config& config,
|
||||
std::unique_ptr<CustomProcessing> capture_post_processor,
|
||||
AudioProcessingImpl(std::unique_ptr<CustomProcessing> capture_post_processor,
|
||||
std::unique_ptr<CustomProcessing> render_pre_processor,
|
||||
std::unique_ptr<EchoControlFactory> echo_control_factory,
|
||||
rtc::scoped_refptr<EchoDetector> echo_detector,
|
||||
|
@ -35,8 +35,7 @@ using ::testing::NotNull;
|
||||
|
||||
class MockInitialize : public AudioProcessingImpl {
|
||||
public:
|
||||
explicit MockInitialize(const webrtc::Config& config)
|
||||
: AudioProcessingImpl(config) {}
|
||||
MockInitialize() : AudioProcessingImpl() {}
|
||||
|
||||
MOCK_METHOD(void, InitializeLocked, (), (override));
|
||||
void RealInitializeLocked() {
|
||||
@ -132,12 +131,11 @@ class TestRenderPreProcessor : public CustomProcessing {
|
||||
} // namespace
|
||||
|
||||
TEST(AudioProcessingImplTest, AudioParameterChangeTriggersInit) {
|
||||
webrtc::Config webrtc_config;
|
||||
MockInitialize mock(webrtc_config);
|
||||
ON_CALL(mock, InitializeLocked())
|
||||
MockInitialize mock;
|
||||
ON_CALL(mock, InitializeLocked)
|
||||
.WillByDefault(Invoke(&mock, &MockInitialize::RealInitializeLocked));
|
||||
|
||||
EXPECT_CALL(mock, InitializeLocked()).Times(1);
|
||||
EXPECT_CALL(mock, InitializeLocked).Times(1);
|
||||
mock.Initialize();
|
||||
|
||||
constexpr size_t kMaxSampleRateHz = 32000;
|
||||
@ -146,20 +144,20 @@ TEST(AudioProcessingImplTest, AudioParameterChangeTriggersInit) {
|
||||
frame.fill(0);
|
||||
StreamConfig config(16000, 1, /*has_keyboard=*/false);
|
||||
// Call with the default parameters; there should be an init.
|
||||
EXPECT_CALL(mock, InitializeLocked()).Times(0);
|
||||
EXPECT_CALL(mock, InitializeLocked).Times(0);
|
||||
EXPECT_NOERR(mock.ProcessStream(frame.data(), config, config, frame.data()));
|
||||
EXPECT_NOERR(
|
||||
mock.ProcessReverseStream(frame.data(), config, config, frame.data()));
|
||||
|
||||
// New sample rate. (Only impacts ProcessStream).
|
||||
config = StreamConfig(32000, 1, /*has_keyboard=*/false);
|
||||
EXPECT_CALL(mock, InitializeLocked()).Times(1);
|
||||
EXPECT_CALL(mock, InitializeLocked).Times(1);
|
||||
EXPECT_NOERR(mock.ProcessStream(frame.data(), config, config, frame.data()));
|
||||
|
||||
// New number of channels.
|
||||
// TODO(peah): Investigate why this causes 2 inits.
|
||||
config = StreamConfig(32000, 2, /*has_keyboard=*/false);
|
||||
EXPECT_CALL(mock, InitializeLocked()).Times(2);
|
||||
EXPECT_CALL(mock, InitializeLocked).Times(2);
|
||||
EXPECT_NOERR(mock.ProcessStream(frame.data(), config, config, frame.data()));
|
||||
// ProcessStream sets num_channels_ == num_output_channels.
|
||||
EXPECT_NOERR(
|
||||
@ -167,7 +165,7 @@ TEST(AudioProcessingImplTest, AudioParameterChangeTriggersInit) {
|
||||
|
||||
// A new sample rate passed to ProcessReverseStream should cause an init.
|
||||
config = StreamConfig(16000, 2, /*has_keyboard=*/false);
|
||||
EXPECT_CALL(mock, InitializeLocked()).Times(1);
|
||||
EXPECT_CALL(mock, InitializeLocked).Times(1);
|
||||
EXPECT_NOERR(
|
||||
mock.ProcessReverseStream(frame.data(), config, config, frame.data()));
|
||||
}
|
||||
@ -605,7 +603,7 @@ TEST(AudioProcessingImplTest, RenderPreProcessorBeforeEchoDetector) {
|
||||
// config should be bit-exact with running APM with said submodules disabled.
|
||||
// This mainly tests that SetCreateOptionalSubmodulesForTesting has an effect.
|
||||
TEST(ApmWithSubmodulesExcludedTest, BitexactWithDisabledModules) {
|
||||
auto apm = rtc::make_ref_counted<AudioProcessingImpl>(webrtc::Config());
|
||||
auto apm = rtc::make_ref_counted<AudioProcessingImpl>();
|
||||
ASSERT_EQ(apm->Initialize(), AudioProcessing::kNoError);
|
||||
|
||||
ApmSubmoduleCreationOverrides overrides;
|
||||
@ -653,7 +651,7 @@ TEST(ApmWithSubmodulesExcludedTest, BitexactWithDisabledModules) {
|
||||
// Disable transient suppressor creation and run APM in ways that should trigger
|
||||
// calls to the transient suppressor API.
|
||||
TEST(ApmWithSubmodulesExcludedTest, ReinitializeTransientSuppressor) {
|
||||
auto apm = rtc::make_ref_counted<AudioProcessingImpl>(webrtc::Config());
|
||||
auto apm = rtc::make_ref_counted<AudioProcessingImpl>();
|
||||
ASSERT_EQ(apm->Initialize(), kNoErr);
|
||||
|
||||
ApmSubmoduleCreationOverrides overrides;
|
||||
@ -714,7 +712,7 @@ TEST(ApmWithSubmodulesExcludedTest, ReinitializeTransientSuppressor) {
|
||||
// Disable transient suppressor creation and run APM in ways that should trigger
|
||||
// calls to the transient suppressor API.
|
||||
TEST(ApmWithSubmodulesExcludedTest, ToggleTransientSuppressor) {
|
||||
auto apm = rtc::make_ref_counted<AudioProcessingImpl>(webrtc::Config());
|
||||
auto apm = rtc::make_ref_counted<AudioProcessingImpl>();
|
||||
ASSERT_EQ(apm->Initialize(), AudioProcessing::kNoError);
|
||||
|
||||
ApmSubmoduleCreationOverrides overrides;
|
||||
|
@ -482,8 +482,7 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
break;
|
||||
}
|
||||
case SettingsType::kDefaultApmDesktop: {
|
||||
Config config;
|
||||
apm_ = AudioProcessingBuilderForTesting().Create(config);
|
||||
apm_ = AudioProcessingBuilderForTesting().Create();
|
||||
ASSERT_TRUE(!!apm_);
|
||||
set_default_desktop_apm_runtime_settings(apm_.get());
|
||||
break;
|
||||
@ -495,15 +494,13 @@ class CallSimulator : public ::testing::TestWithParam<SimulationConfig> {
|
||||
break;
|
||||
}
|
||||
case SettingsType::kDefaultApmDesktopWithoutDelayAgnostic: {
|
||||
Config config;
|
||||
apm_ = AudioProcessingBuilderForTesting().Create(config);
|
||||
apm_ = AudioProcessingBuilderForTesting().Create();
|
||||
ASSERT_TRUE(!!apm_);
|
||||
set_default_desktop_apm_runtime_settings(apm_.get());
|
||||
break;
|
||||
}
|
||||
case SettingsType::kDefaultApmDesktopWithoutExtendedFilter: {
|
||||
Config config;
|
||||
apm_ = AudioProcessingBuilderForTesting().Create(config);
|
||||
apm_ = AudioProcessingBuilderForTesting().Create();
|
||||
ASSERT_TRUE(!!apm_);
|
||||
set_default_desktop_apm_runtime_settings(apm_.get());
|
||||
break;
|
||||
|
@ -2673,14 +2673,13 @@ class MyEchoControlFactory : public EchoControlFactory {
|
||||
|
||||
TEST(ApmConfiguration, EchoControlInjection) {
|
||||
// Verify that apm uses an injected echo controller if one is provided.
|
||||
webrtc::Config webrtc_config;
|
||||
std::unique_ptr<EchoControlFactory> echo_control_factory(
|
||||
new MyEchoControlFactory());
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> apm =
|
||||
AudioProcessingBuilderForTesting()
|
||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||
.Create(webrtc_config);
|
||||
.Create();
|
||||
|
||||
Int16FrameData audio;
|
||||
audio.num_channels = 1;
|
||||
@ -2700,9 +2699,8 @@ TEST(ApmConfiguration, EchoControlInjection) {
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> CreateApm(bool mobile_aec) {
|
||||
Config old_config;
|
||||
rtc::scoped_refptr<AudioProcessing> apm =
|
||||
AudioProcessingBuilderForTesting().Create(old_config);
|
||||
AudioProcessingBuilderForTesting().Create();
|
||||
if (!apm) {
|
||||
return apm;
|
||||
}
|
||||
|
@ -65,19 +65,6 @@ static constexpr int kAgcStartupMinVolume = 0;
|
||||
#endif // defined(WEBRTC_CHROMIUM_BUILD)
|
||||
static constexpr int kClippedLevelMin = 70;
|
||||
|
||||
// To be deprecated: Please instead use the flag in the
|
||||
// AudioProcessing::Config::TransientSuppression.
|
||||
//
|
||||
// Use to enable experimental noise suppression. It can be set in the
|
||||
// constructor.
|
||||
// TODO(webrtc:5298): Remove.
|
||||
struct ExperimentalNs {
|
||||
ExperimentalNs() : enabled(false) {}
|
||||
explicit ExperimentalNs(bool enabled) : enabled(enabled) {}
|
||||
static const ConfigOptionID identifier = ConfigOptionID::kExperimentalNs;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
// The Audio Processing Module (APM) provides a collection of voice processing
|
||||
// components designed for real-time communications software.
|
||||
//
|
||||
@ -800,7 +787,6 @@ class RTC_EXPORT AudioProcessingBuilder {
|
||||
// This creates an APM instance using the previously set components. Calling
|
||||
// the Create function resets the AudioProcessingBuilder to its initial state.
|
||||
rtc::scoped_refptr<AudioProcessing> Create();
|
||||
rtc::scoped_refptr<AudioProcessing> Create(const webrtc::Config& config);
|
||||
|
||||
private:
|
||||
std::unique_ptr<EchoControlFactory> echo_control_factory_;
|
||||
|
@ -24,16 +24,10 @@ AudioProcessingBuilderForTesting::~AudioProcessingBuilderForTesting() = default;
|
||||
#ifdef WEBRTC_EXCLUDE_AUDIO_PROCESSING_MODULE
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilderForTesting::Create() {
|
||||
webrtc::Config config;
|
||||
return Create(config);
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilderForTesting::Create(
|
||||
const webrtc::Config& config) {
|
||||
return rtc::make_ref_counted<AudioProcessingImpl>(
|
||||
config, std::move(capture_post_processing_),
|
||||
std::move(render_pre_processing_), std::move(echo_control_factory_),
|
||||
std::move(echo_detector_), std::move(capture_analyzer_));
|
||||
std::move(capture_post_processing_), std::move(render_pre_processing_),
|
||||
std::move(echo_control_factory_), std::move(echo_detector_),
|
||||
std::move(capture_analyzer_));
|
||||
}
|
||||
|
||||
#else
|
||||
@ -44,13 +38,6 @@ rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilderForTesting::Create() {
|
||||
return builder.Create();
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> AudioProcessingBuilderForTesting::Create(
|
||||
const webrtc::Config& config) {
|
||||
AudioProcessingBuilder builder;
|
||||
TransferOwnershipsToBuilder(&builder);
|
||||
return builder.Create(config);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void AudioProcessingBuilderForTesting::TransferOwnershipsToBuilder(
|
||||
|
@ -63,7 +63,6 @@ class AudioProcessingBuilderForTesting {
|
||||
// the Create function resets the AudioProcessingBuilderForTesting to its
|
||||
// initial state.
|
||||
rtc::scoped_refptr<AudioProcessing> Create();
|
||||
rtc::scoped_refptr<AudioProcessing> Create(const webrtc::Config& config);
|
||||
|
||||
private:
|
||||
// Transfers the ownership to a non-testing builder.
|
||||
|
@ -178,14 +178,13 @@ void DebugDumpReplayer::OnRuntimeSettingEvent(
|
||||
|
||||
void DebugDumpReplayer::MaybeRecreateApm(const audioproc::Config& msg) {
|
||||
// These configurations cannot be changed on the fly.
|
||||
Config config;
|
||||
RTC_CHECK(msg.has_aec_delay_agnostic_enabled());
|
||||
RTC_CHECK(msg.has_aec_extended_filter_enabled());
|
||||
|
||||
// We only create APM once, since changes on these fields should not
|
||||
// happen in current implementation.
|
||||
if (!apm_.get()) {
|
||||
apm_ = AudioProcessingBuilderForTesting().Create(config);
|
||||
apm_ = AudioProcessingBuilderForTesting().Create();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,11 @@ class DebugDumpGenerator {
|
||||
const std::string& reverse_file_name,
|
||||
int reverse_rate_hz,
|
||||
int reverse_channels,
|
||||
const Config& config,
|
||||
const std::string& dump_file_name,
|
||||
bool enable_pre_amplifier);
|
||||
|
||||
// Constructor that uses default input files.
|
||||
explicit DebugDumpGenerator(const Config& config,
|
||||
const AudioProcessing::Config& apm_config);
|
||||
explicit DebugDumpGenerator(const AudioProcessing::Config& apm_config);
|
||||
|
||||
~DebugDumpGenerator();
|
||||
|
||||
@ -123,7 +121,6 @@ DebugDumpGenerator::DebugDumpGenerator(const std::string& input_file_name,
|
||||
const std::string& reverse_file_name,
|
||||
int reverse_rate_hz,
|
||||
int reverse_channels,
|
||||
const Config& config,
|
||||
const std::string& dump_file_name,
|
||||
bool enable_pre_amplifier)
|
||||
: input_config_(input_rate_hz, input_channels),
|
||||
@ -143,11 +140,10 @@ DebugDumpGenerator::DebugDumpGenerator(const std::string& input_file_name,
|
||||
worker_queue_("debug_dump_generator_worker_queue"),
|
||||
dump_file_name_(dump_file_name) {
|
||||
AudioProcessingBuilderForTesting apm_builder;
|
||||
apm_ = apm_builder.Create(config);
|
||||
apm_ = apm_builder.Create();
|
||||
}
|
||||
|
||||
DebugDumpGenerator::DebugDumpGenerator(
|
||||
const Config& config,
|
||||
const AudioProcessing::Config& apm_config)
|
||||
: DebugDumpGenerator(ResourcePath("near32_stereo", "pcm"),
|
||||
32000,
|
||||
@ -155,7 +151,6 @@ DebugDumpGenerator::DebugDumpGenerator(
|
||||
ResourcePath("far32_stereo", "pcm"),
|
||||
32000,
|
||||
2,
|
||||
config,
|
||||
TempFilename(OutputPath(), "debug_aec"),
|
||||
apm_config.pre_amplifier.enabled) {
|
||||
apm_->ApplyConfig(apm_config);
|
||||
@ -290,8 +285,7 @@ void DebugDumpTest::VerifyDebugDump(const std::string& in_filename) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, SimpleCase) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -299,8 +293,7 @@ TEST_F(DebugDumpTest, SimpleCase) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, ChangeInputFormat) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
@ -317,8 +310,7 @@ TEST_F(DebugDumpTest, ChangeInputFormat) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, ChangeReverseFormat) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.SetReverseRate(48000);
|
||||
@ -329,8 +321,7 @@ TEST_F(DebugDumpTest, ChangeReverseFormat) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, ChangeOutputFormat) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.SetOutputRate(48000);
|
||||
@ -341,10 +332,9 @@ TEST_F(DebugDumpTest, ChangeOutputFormat) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, ToggleAec) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
DebugDumpGenerator generator(apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
|
||||
@ -357,14 +347,13 @@ TEST_F(DebugDumpTest, ToggleAec) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
apm_config.gain_controller1.analog_gain_controller.enabled = true;
|
||||
apm_config.gain_controller1.analog_gain_controller.startup_min_volume = 0;
|
||||
// Arbitrarily set clipping gain to 17, which will never be the default.
|
||||
apm_config.gain_controller1.analog_gain_controller.clipped_level_min = 17;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
DebugDumpGenerator generator(apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -388,10 +377,9 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringInclusive) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
DebugDumpGenerator generator(apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -414,10 +402,9 @@ TEST_F(DebugDumpTest, VerifyCombinedExperimentalStringExclusive) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.echo_canceller.enabled = true;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
DebugDumpGenerator generator(apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -439,13 +426,12 @@ TEST_F(DebugDumpTest, VerifyAec3ExperimentalString) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyAgcClippingLevelExperimentalString) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.gain_controller1.analog_gain_controller.enabled = true;
|
||||
apm_config.gain_controller1.analog_gain_controller.startup_min_volume = 0;
|
||||
// Arbitrarily set clipping gain to 17, which will never be the default.
|
||||
apm_config.gain_controller1.analog_gain_controller.clipped_level_min = 17;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
DebugDumpGenerator generator(apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -467,8 +453,7 @@ TEST_F(DebugDumpTest, VerifyAgcClippingLevelExperimentalString) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
@ -495,8 +480,7 @@ TEST_F(DebugDumpTest, VerifyEmptyExperimentalString) {
|
||||
#define MAYBE_ToggleAgc ToggleAgc
|
||||
#endif
|
||||
TEST_F(DebugDumpTest, MAYBE_ToggleAgc) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
|
||||
@ -510,8 +494,7 @@ TEST_F(DebugDumpTest, MAYBE_ToggleAgc) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, ToggleNs) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
|
||||
@ -525,8 +508,7 @@ TEST_F(DebugDumpTest, ToggleNs) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, TransientSuppressionOn) {
|
||||
Config config;
|
||||
DebugDumpGenerator generator(config, AudioProcessing::Config());
|
||||
DebugDumpGenerator generator(/*apm_config=*/{});
|
||||
|
||||
AudioProcessing::Config apm_config = generator.apm()->GetConfig();
|
||||
apm_config.transient_suppression.enabled = true;
|
||||
@ -539,10 +521,9 @@ TEST_F(DebugDumpTest, TransientSuppressionOn) {
|
||||
}
|
||||
|
||||
TEST_F(DebugDumpTest, PreAmplifierIsOn) {
|
||||
Config config;
|
||||
AudioProcessing::Config apm_config;
|
||||
apm_config.pre_amplifier.enabled = true;
|
||||
DebugDumpGenerator generator(config, apm_config);
|
||||
DebugDumpGenerator generator(apm_config);
|
||||
generator.StartRecording();
|
||||
generator.Process(100);
|
||||
generator.StopRecording();
|
||||
|
@ -40,7 +40,7 @@ rtc::scoped_refptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
|
||||
// Parse boolean values for optionally enabling different
|
||||
// configurable public components of APM.
|
||||
static_cast<void>(fuzz_data->ReadOrDefaultValue(true));
|
||||
bool exp_ns = fuzz_data->ReadOrDefaultValue(true);
|
||||
bool use_ts = fuzz_data->ReadOrDefaultValue(true);
|
||||
static_cast<void>(fuzz_data->ReadOrDefaultValue(true));
|
||||
static_cast<void>(fuzz_data->ReadOrDefaultValue(true));
|
||||
static_cast<void>(fuzz_data->ReadOrDefaultValue(true));
|
||||
@ -96,21 +96,15 @@ rtc::scoped_refptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Components can be enabled through webrtc::Config and
|
||||
// webrtc::AudioProcessingConfig.
|
||||
Config config;
|
||||
|
||||
std::unique_ptr<EchoControlFactory> echo_control_factory;
|
||||
if (aec3) {
|
||||
echo_control_factory.reset(new EchoCanceller3Factory());
|
||||
}
|
||||
|
||||
config.Set<ExperimentalNs>(new ExperimentalNs(exp_ns));
|
||||
|
||||
rtc::scoped_refptr<AudioProcessing> apm =
|
||||
AudioProcessingBuilderForTesting()
|
||||
.SetEchoControlFactory(std::move(echo_control_factory))
|
||||
.Create(config);
|
||||
.Create();
|
||||
|
||||
#ifdef WEBRTC_LINUX
|
||||
apm->AttachAecDump(AecDumpFactory::Create("/dev/null", -1, worker_queue));
|
||||
@ -138,6 +132,7 @@ rtc::scoped_refptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
|
||||
apm_config.gain_controller2.adaptive_digital.use_saturation_protector =
|
||||
use_agc2_adaptive_digital_saturation_protector;
|
||||
apm_config.noise_suppression.enabled = use_ns;
|
||||
apm_config.transient_suppression.enabled = use_ts;
|
||||
apm_config.voice_detection.enabled = use_vad;
|
||||
apm_config.level_estimation.enabled = use_le;
|
||||
apm->ApplyConfig(apm_config);
|
||||
|
Reference in New Issue
Block a user