Support forcing field trial in audioproc_f simulator

This allows the user to run audioproc_f with various field trials set.
The approach is copied from test/test_main_lib.cc.

Tested:
1. Verified bitexactness vs ToT audioproc_f on a large dataset of aecdumps
2. Ran it with flags --aec=1 --force_fieldtrials="WebRTC-Aec3ClampInstQualityToZeroKillSwitch/Enabled/WebRTC-Aec3ClampInstQualityToOneKillSwitch/Enabled/" and verified in GDB that the AEC3 config was changed accordingly.


No-Try: True
Bug: webrtc:5298
Change-Id: I70eec7777f70893b36af33794a5842f67d56af31
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172623
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30976}
This commit is contained in:
saza
2020-04-01 17:42:01 +02:00
committed by Commit Bot
parent 1251e4a69a
commit 0cf99ce865
2 changed files with 14 additions and 0 deletions

View File

@ -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",

View File

@ -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<AudioProcessingBuilder> 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;