Add a parameter to audioproc for overriding the delay.

Rename the parameter for adding to the input delay to "add_delay".

R=bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/2345007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4939 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2013-10-07 16:44:32 +00:00
parent 11e9cbc399
commit ca764ab22d

View File

@ -133,7 +133,8 @@ void usage() {
printf("\n"); printf("\n");
printf("Modifiers:\n"); printf("Modifiers:\n");
printf(" --noasm Disable SSE optimization.\n"); printf(" --noasm Disable SSE optimization.\n");
printf(" --delay DELAY Add DELAY ms to input value.\n"); printf(" --add_delay DELAY Add DELAY ms to input value.\n");
printf(" --delay DELAY Override input delay with DELAY ms.\n");
printf(" --perf Measure performance.\n"); printf(" --perf Measure performance.\n");
printf(" --quiet Suppress text output.\n"); printf(" --quiet Suppress text output.\n");
printf(" --no_progress Suppress progress.\n"); printf(" --no_progress Suppress progress.\n");
@ -194,6 +195,7 @@ void void_main(int argc, char* argv[]) {
bool verbose = true; bool verbose = true;
bool progress = true; bool progress = true;
int extra_delay_ms = 0; int extra_delay_ms = 0;
int override_delay_ms = 0;
//bool interleaved = true; //bool interleaved = true;
ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true)); ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true));
@ -430,10 +432,14 @@ void void_main(int argc, char* argv[]) {
// We need to reinitialize here if components have already been enabled. // We need to reinitialize here if components have already been enabled.
ASSERT_EQ(apm->kNoError, apm->Initialize()); ASSERT_EQ(apm->kNoError, apm->Initialize());
} else if (strcmp(argv[i], "--delay") == 0) { } else if (strcmp(argv[i], "--add_delay") == 0) {
i++; i++;
ASSERT_EQ(1, sscanf(argv[i], "%d", &extra_delay_ms)); ASSERT_EQ(1, sscanf(argv[i], "%d", &extra_delay_ms));
} else if (strcmp(argv[i], "--delay") == 0) {
i++;
ASSERT_EQ(1, sscanf(argv[i], "%d", &override_delay_ms));
} else if (strcmp(argv[i], "--perf") == 0) { } else if (strcmp(argv[i], "--perf") == 0) {
perf_testing = true; perf_testing = true;
@ -715,8 +721,12 @@ void void_main(int argc, char* argv[]) {
ASSERT_EQ(apm->kNoError, ASSERT_EQ(apm->kNoError,
apm->gain_control()->set_stream_analog_level(msg.level())); apm->gain_control()->set_stream_analog_level(msg.level()));
delay_ms = msg.delay() + extra_delay_ms;
if (override_delay_ms) {
delay_ms = override_delay_ms;
}
ASSERT_EQ(apm->kNoError, ASSERT_EQ(apm->kNoError,
apm->set_stream_delay_ms(msg.delay() + extra_delay_ms)); apm->set_stream_delay_ms(delay_ms));
apm->echo_cancellation()->set_stream_drift_samples(msg.drift()); apm->echo_cancellation()->set_stream_drift_samples(msg.drift());
int err = apm->ProcessStream(&near_frame); int err = apm->ProcessStream(&near_frame);
@ -918,8 +928,12 @@ void void_main(int argc, char* argv[]) {
const int capture_level_in = capture_level; const int capture_level_in = capture_level;
ASSERT_EQ(apm->kNoError, ASSERT_EQ(apm->kNoError,
apm->gain_control()->set_stream_analog_level(capture_level)); apm->gain_control()->set_stream_analog_level(capture_level));
delay_ms += extra_delay_ms;
if (override_delay_ms) {
delay_ms = override_delay_ms;
}
ASSERT_EQ(apm->kNoError, ASSERT_EQ(apm->kNoError,
apm->set_stream_delay_ms(delay_ms + extra_delay_ms)); apm->set_stream_delay_ms(delay_ms));
apm->echo_cancellation()->set_stream_drift_samples(drift_samples); apm->echo_cancellation()->set_stream_drift_samples(drift_samples);
int err = apm->ProcessStream(&near_frame); int err = apm->ProcessStream(&near_frame);