audio_processing: Fixed incorrect usage of SetExtraOptions() in offline tool
The way SetExtraOptions() is used today only applies for any one configuration change. The correct way is to set it after all flags have been scanned.
The prefered way to solve this is to use gflags and scan once, followed by applying the configuration when creating audio_processing. This is what is done in the new test tool audioproc_float.cc, but there are still some things left to do before we can replace this one.
BUG=N/A
TESTED=locally
R=kwiberg@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/45279004
Cr-Commit-Position: refs/heads/master@{#9097}
diff --git a/webrtc/modules/audio_processing/test/process_test.cc b/webrtc/modules/audio_processing/test/process_test.cc
index d32dcb8..3218243 100644
--- a/webrtc/modules/audio_processing/test/process_test.cc
+++ b/webrtc/modules/audio_processing/test/process_test.cc
@@ -171,6 +171,7 @@
bool raw_output = false;
int extra_delay_ms = 0;
int override_delay_ms = 0;
+ Config config;
ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true));
for (int i = 1; i < argc; i++) {
@@ -256,14 +257,10 @@
suppression_level)));
} else if (strcmp(argv[i], "--extended_filter") == 0) {
- Config config;
config.Set<DelayCorrection>(new DelayCorrection(true));
- apm->SetExtraOptions(config);
} else if (strcmp(argv[i], "--no_reported_delay") == 0) {
- Config config;
config.Set<ReportedDelay>(new ReportedDelay(false));
- apm->SetExtraOptions(config);
} else if (strcmp(argv[i], "-aecm") == 0) {
ASSERT_EQ(apm->kNoError, apm->echo_control_mobile()->Enable(true));
@@ -402,9 +399,7 @@
vad_out_filename = argv[i];
} else if (strcmp(argv[i], "-expns") == 0) {
- Config config;
config.Set<ExperimentalNs>(new ExperimentalNs(true));
- apm->SetExtraOptions(config);
} else if (strcmp(argv[i], "--noasm") == 0) {
WebRtc_GetCPUInfo = WebRtc_GetCPUInfoNoASM;
@@ -440,6 +435,8 @@
FAIL() << "Unrecognized argument " << argv[i];
}
}
+ apm->SetExtraOptions(config);
+
// If we're reading a protobuf file, ensure a simulation hasn't also
// been requested (which makes no sense...)
ASSERT_FALSE(pb_filename && simulating);