Fuzz more aec3 field trials

There are many new killswitches for AEC3 code.
By fuzzing them, we ensure the code is more thoroughly tested in case
we need to trigger any switches.

Bug: webrtc:9413
Change-Id: I0bc7609e4d71fc820abfbba7d481b2374c3587cb
Reviewed-on: https://webrtc-review.googlesource.com/88225
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23960}
This commit is contained in:
Sam Zackrisson 2018-07-13 10:20:30 +02:00 committed by Commit Bot
parent 010a46dec8
commit b5d3802b7a

View File

@ -38,7 +38,14 @@ const std::string kFieldTrialNames[] = {
"WebRTC-Aec3ZeroExternalDelayHeadroomKillSwitch",
"WebRTC-Aec3DownSamplingFactor8KillSwitch",
"WebRTC-Aec3EnforceSkewHysteresis1",
"WebRTC-Aec3EnforceSkewHysteresis2"};
"WebRTC-Aec3EnforceSkewHysteresis2",
"WebRTC-Aec3NewSuppressionKillSwitch",
"WebRTC-Aec3LinearModeWithDivergedFilterKillSwitch",
"WebRTC-Aec3MisadjustmentEstimatorKillSwitch",
"WebRTC-Aec3RapidAgcGainRecoveryKillSwitch",
"WebRTC-Aec3SlowFilterAdaptationKillSwitch",
"WebRTC-Aec3SmoothUpdatesTailFreqRespKillSwitch",
"WebRTC-Aec3SuppressorNearendAveragingKillSwitch"};
std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
std::string* field_trial_string) {
@ -69,11 +76,11 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
rtc::SafeClamp<int>(fuzz_data->ReadOrDefaultValue<int8_t>(0), -50, 50);
constexpr size_t kNumFieldTrials = arraysize(kFieldTrialNames);
// This check ensures the uint16_t that is read has enough bits to cover all
// the field trials.
RTC_DCHECK_LE(kNumFieldTrials, 16);
// Verify that the read data type has enough bits to fuzz the field trials.
using FieldTrialBitmaskType = uint32_t;
RTC_DCHECK_LE(kNumFieldTrials, sizeof(FieldTrialBitmaskType) * 8);
std::bitset<kNumFieldTrials> field_trial_bitmask(
fuzz_data->ReadOrDefaultValue<uint16_t>(0));
fuzz_data->ReadOrDefaultValue<FieldTrialBitmaskType>(0));
for (size_t i = 0; i < kNumFieldTrials; ++i) {
if (field_trial_bitmask[i]) {
*field_trial_string += kFieldTrialNames[i] + "/Enabled/";