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}
This commit is contained in:
Bjorn Volcker
2015-04-28 13:52:50 +02:00
parent ddbddbdee6
commit beb9798ab4

View File

@@ -171,6 +171,7 @@ void void_main(int argc, char* argv[]) {
bool raw_output = false; bool raw_output = false;
int extra_delay_ms = 0; int extra_delay_ms = 0;
int override_delay_ms = 0; int override_delay_ms = 0;
Config config;
ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true)); ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true));
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
@@ -256,14 +257,10 @@ void void_main(int argc, char* argv[]) {
suppression_level))); suppression_level)));
} else if (strcmp(argv[i], "--extended_filter") == 0) { } else if (strcmp(argv[i], "--extended_filter") == 0) {
Config config;
config.Set<DelayCorrection>(new DelayCorrection(true)); config.Set<DelayCorrection>(new DelayCorrection(true));
apm->SetExtraOptions(config);
} else if (strcmp(argv[i], "--no_reported_delay") == 0) { } else if (strcmp(argv[i], "--no_reported_delay") == 0) {
Config config;
config.Set<ReportedDelay>(new ReportedDelay(false)); config.Set<ReportedDelay>(new ReportedDelay(false));
apm->SetExtraOptions(config);
} else if (strcmp(argv[i], "-aecm") == 0) { } else if (strcmp(argv[i], "-aecm") == 0) {
ASSERT_EQ(apm->kNoError, apm->echo_control_mobile()->Enable(true)); ASSERT_EQ(apm->kNoError, apm->echo_control_mobile()->Enable(true));
@@ -402,9 +399,7 @@ void void_main(int argc, char* argv[]) {
vad_out_filename = argv[i]; vad_out_filename = argv[i];
} else if (strcmp(argv[i], "-expns") == 0) { } else if (strcmp(argv[i], "-expns") == 0) {
Config config;
config.Set<ExperimentalNs>(new ExperimentalNs(true)); config.Set<ExperimentalNs>(new ExperimentalNs(true));
apm->SetExtraOptions(config);
} else if (strcmp(argv[i], "--noasm") == 0) { } else if (strcmp(argv[i], "--noasm") == 0) {
WebRtc_GetCPUInfo = WebRtc_GetCPUInfoNoASM; WebRtc_GetCPUInfo = WebRtc_GetCPUInfoNoASM;
@@ -440,6 +435,8 @@ void void_main(int argc, char* argv[]) {
FAIL() << "Unrecognized argument " << argv[i]; FAIL() << "Unrecognized argument " << argv[i];
} }
} }
apm->SetExtraOptions(config);
// If we're reading a protobuf file, ensure a simulation hasn't also // If we're reading a protobuf file, ensure a simulation hasn't also
// been requested (which makes no sense...) // been requested (which makes no sense...)
ASSERT_FALSE(pb_filename && simulating); ASSERT_FALSE(pb_filename && simulating);