Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: webrtc/modules/audio_processing/test/process_test.cc

Issue 2292863002: Introduced new scheme for controlling the functionality inside the audio processing module (Closed)
Patch Set: Changes in response to reviewer comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 int samples_per_channel = sample_rate_hz / 100; 170 int samples_per_channel = sample_rate_hz / 100;
171 171
172 bool simulating = false; 172 bool simulating = false;
173 bool perf_testing = false; 173 bool perf_testing = false;
174 bool verbose = true; 174 bool verbose = true;
175 bool progress = true; 175 bool progress = true;
176 bool raw_output = false; 176 bool raw_output = false;
177 int extra_delay_ms = 0; 177 int extra_delay_ms = 0;
178 int override_delay_ms = 0; 178 int override_delay_ms = 0;
179 Config config; 179 Config config;
180 AudioProcessing::Config apm_config;
180 181
181 ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true)); 182 ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true));
182 for (int i = 1; i < argc; i++) { 183 for (int i = 1; i < argc; i++) {
183 if (strcmp(argv[i], "-pb") == 0) { 184 if (strcmp(argv[i], "-pb") == 0) {
184 i++; 185 i++;
185 ASSERT_LT(i, argc) << "Specify protobuf filename after -pb"; 186 ASSERT_LT(i, argc) << "Specify protobuf filename after -pb";
186 pb_filename = argv[i]; 187 pb_filename = argv[i];
187 188
188 } else if (strcmp(argv[i], "-ir") == 0) { 189 } else if (strcmp(argv[i], "-ir") == 0) {
189 i++; 190 i++;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 i++; 256 i++;
256 ASSERT_LT(i, argc) << "Specify level after --aec_suppression_level"; 257 ASSERT_LT(i, argc) << "Specify level after --aec_suppression_level";
257 int suppression_level; 258 int suppression_level;
258 ASSERT_EQ(1, sscanf(argv[i], "%d", &suppression_level)); 259 ASSERT_EQ(1, sscanf(argv[i], "%d", &suppression_level));
259 ASSERT_EQ(apm->kNoError, 260 ASSERT_EQ(apm->kNoError,
260 apm->echo_cancellation()->set_suppression_level( 261 apm->echo_cancellation()->set_suppression_level(
261 static_cast<webrtc::EchoCancellation::SuppressionLevel>( 262 static_cast<webrtc::EchoCancellation::SuppressionLevel>(
262 suppression_level))); 263 suppression_level)));
263 264
264 } else if (strcmp(argv[i], "--level_control") == 0) { 265 } else if (strcmp(argv[i], "--level_control") == 0) {
265 config.Set<LevelControl>(new LevelControl(true)); 266 apm_config.level_controller.enabled = true;
266
267 } else if (strcmp(argv[i], "--extended_filter") == 0) { 267 } else if (strcmp(argv[i], "--extended_filter") == 0) {
268 config.Set<ExtendedFilter>(new ExtendedFilter(true)); 268 config.Set<ExtendedFilter>(new ExtendedFilter(true));
269 269
270 } else if (strcmp(argv[i], "--no_reported_delay") == 0) { 270 } else if (strcmp(argv[i], "--no_reported_delay") == 0) {
271 config.Set<DelayAgnostic>(new DelayAgnostic(true)); 271 config.Set<DelayAgnostic>(new DelayAgnostic(true));
272 272
273 } else if (strcmp(argv[i], "--delay_agnostic") == 0) { 273 } else if (strcmp(argv[i], "--delay_agnostic") == 0) {
274 config.Set<DelayAgnostic>(new DelayAgnostic(true)); 274 config.Set<DelayAgnostic>(new DelayAgnostic(true));
275 275
276 } else if (strcmp(argv[i], "--aec3") == 0) { 276 } else if (strcmp(argv[i], "--aec3") == 0) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 raw_output = true; 445 raw_output = true;
446 446
447 } else if (strcmp(argv[i], "--debug_file") == 0) { 447 } else if (strcmp(argv[i], "--debug_file") == 0) {
448 i++; 448 i++;
449 ASSERT_LT(i, argc) << "Specify filename after --debug_file"; 449 ASSERT_LT(i, argc) << "Specify filename after --debug_file";
450 ASSERT_EQ(apm->kNoError, apm->StartDebugRecording(argv[i], -1)); 450 ASSERT_EQ(apm->kNoError, apm->StartDebugRecording(argv[i], -1));
451 } else { 451 } else {
452 FAIL() << "Unrecognized argument " << argv[i]; 452 FAIL() << "Unrecognized argument " << argv[i];
453 } 453 }
454 } 454 }
455 RTC_DCHECK(apm_config.Validate());
the sun 2016/09/01 13:48:01 dd
peah-webrtc 2016/09/02 08:22:03 Done.
456 RTC_CHECK(apm->ApplyConfig(apm_config));
455 apm->SetExtraOptions(config); 457 apm->SetExtraOptions(config);
456 458
457 // If we're reading a protobuf file, ensure a simulation hasn't also 459 // If we're reading a protobuf file, ensure a simulation hasn't also
458 // been requested (which makes no sense...) 460 // been requested (which makes no sense...)
459 ASSERT_FALSE(pb_filename && simulating); 461 ASSERT_FALSE(pb_filename && simulating);
460 462
461 if (verbose) { 463 if (verbose) {
462 printf("Sample rate: %d Hz\n", sample_rate_hz); 464 printf("Sample rate: %d Hz\n", sample_rate_hz);
463 printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n", 465 printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n",
464 num_capture_input_channels, 466 num_capture_input_channels,
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 } // namespace 1157 } // namespace
1156 } // namespace webrtc 1158 } // namespace webrtc
1157 1159
1158 int main(int argc, char* argv[]) { 1160 int main(int argc, char* argv[]) {
1159 webrtc::void_main(argc, argv); 1161 webrtc::void_main(argc, argv);
1160 1162
1161 // Optional, but removes memory leak noise from Valgrind. 1163 // Optional, but removes memory leak noise from Valgrind.
1162 google::protobuf::ShutdownProtobufLibrary(); 1164 google::protobuf::ShutdownProtobufLibrary();
1163 return 0; 1165 return 0;
1164 } 1166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698