diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn index 6e9f584c75..2c7b73b12d 100644 --- a/modules/audio_processing/BUILD.gn +++ b/modules/audio_processing/BUILD.gn @@ -542,6 +542,7 @@ if (rtc_include_tests) { "../../rtc_base:task_queue_for_test", "../../rtc_base/system:file_wrapper", "../../system_wrappers", + "../../system_wrappers:field_trial", "../../test:test_support", "aec_dump", "aec_dump:aec_dump_impl", diff --git a/modules/audio_processing/test/audioproc_float_impl.cc b/modules/audio_processing/test/audioproc_float_impl.cc index a37856ecdf..d9a4227eb7 100644 --- a/modules/audio_processing/test/audioproc_float_impl.cc +++ b/modules/audio_processing/test/audioproc_float_impl.cc @@ -27,6 +27,7 @@ #include "modules/audio_processing/test/wav_based_simulator.h" #include "rtc_base/checks.h" #include "rtc_base/strings/string_builder.h" +#include "system_wrappers/include/field_trial.h" constexpr int kParameterNotSpecifiedValue = -10000; @@ -256,6 +257,13 @@ ABSL_FLAG(bool, false, "Produce floating point wav output files."); +ABSL_FLAG(std::string, + force_fieldtrials, + "", + "Field trials control experimental feature code which can be forced. " + "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" + " will assign the group Enable to field trial WebRTC-FooFeature."); + namespace webrtc { namespace test { namespace { @@ -631,6 +639,11 @@ int AudioprocFloatImpl(std::unique_ptr ap_builder, return 1; } + // InitFieldTrialsFromString stores the char*, so the char array must + // outlive the application. + const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials); + webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str()); + SimulationSettings settings = CreateSettings(); if (!input_aecdump.empty()) { settings.aec_dump_input_string = input_aecdump;