OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 apm->ApplyConfig(apm_config); |
455 apm->SetExtraOptions(config); | 456 apm->SetExtraOptions(config); |
456 | 457 |
457 // If we're reading a protobuf file, ensure a simulation hasn't also | 458 // If we're reading a protobuf file, ensure a simulation hasn't also |
458 // been requested (which makes no sense...) | 459 // been requested (which makes no sense...) |
459 ASSERT_FALSE(pb_filename && simulating); | 460 ASSERT_FALSE(pb_filename && simulating); |
460 | 461 |
461 if (verbose) { | 462 if (verbose) { |
462 printf("Sample rate: %d Hz\n", sample_rate_hz); | 463 printf("Sample rate: %d Hz\n", sample_rate_hz); |
463 printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n", | 464 printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n", |
464 num_capture_input_channels, | 465 num_capture_input_channels, |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 } // namespace | 1156 } // namespace |
1156 } // namespace webrtc | 1157 } // namespace webrtc |
1157 | 1158 |
1158 int main(int argc, char* argv[]) { | 1159 int main(int argc, char* argv[]) { |
1159 webrtc::void_main(argc, argv); | 1160 webrtc::void_main(argc, argv); |
1160 | 1161 |
1161 // Optional, but removes memory leak noise from Valgrind. | 1162 // Optional, but removes memory leak noise from Valgrind. |
1162 google::protobuf::ShutdownProtobufLibrary(); | 1163 google::protobuf::ShutdownProtobufLibrary(); |
1163 return 0; | 1164 return 0; |
1164 } | 1165 } |
OLD | NEW |