| 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; | |
| 181 | 180 |
| 182 ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true)); | 181 ASSERT_EQ(apm->kNoError, apm->level_estimator()->Enable(true)); |
| 183 for (int i = 1; i < argc; i++) { | 182 for (int i = 1; i < argc; i++) { |
| 184 if (strcmp(argv[i], "-pb") == 0) { | 183 if (strcmp(argv[i], "-pb") == 0) { |
| 185 i++; | 184 i++; |
| 186 ASSERT_LT(i, argc) << "Specify protobuf filename after -pb"; | 185 ASSERT_LT(i, argc) << "Specify protobuf filename after -pb"; |
| 187 pb_filename = argv[i]; | 186 pb_filename = argv[i]; |
| 188 | 187 |
| 189 } else if (strcmp(argv[i], "-ir") == 0) { | 188 } else if (strcmp(argv[i], "-ir") == 0) { |
| 190 i++; | 189 i++; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 i++; | 255 i++; |
| 257 ASSERT_LT(i, argc) << "Specify level after --aec_suppression_level"; | 256 ASSERT_LT(i, argc) << "Specify level after --aec_suppression_level"; |
| 258 int suppression_level; | 257 int suppression_level; |
| 259 ASSERT_EQ(1, sscanf(argv[i], "%d", &suppression_level)); | 258 ASSERT_EQ(1, sscanf(argv[i], "%d", &suppression_level)); |
| 260 ASSERT_EQ(apm->kNoError, | 259 ASSERT_EQ(apm->kNoError, |
| 261 apm->echo_cancellation()->set_suppression_level( | 260 apm->echo_cancellation()->set_suppression_level( |
| 262 static_cast<webrtc::EchoCancellation::SuppressionLevel>( | 261 static_cast<webrtc::EchoCancellation::SuppressionLevel>( |
| 263 suppression_level))); | 262 suppression_level))); |
| 264 | 263 |
| 265 } else if (strcmp(argv[i], "--level_control") == 0) { | 264 } else if (strcmp(argv[i], "--level_control") == 0) { |
| 266 apm_config.level_controller.enabled = true; | 265 config.Set<LevelControl>(new LevelControl(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); | |
| 456 apm->SetExtraOptions(config); | 455 apm->SetExtraOptions(config); |
| 457 | 456 |
| 458 // If we're reading a protobuf file, ensure a simulation hasn't also | 457 // If we're reading a protobuf file, ensure a simulation hasn't also |
| 459 // been requested (which makes no sense...) | 458 // been requested (which makes no sense...) |
| 460 ASSERT_FALSE(pb_filename && simulating); | 459 ASSERT_FALSE(pb_filename && simulating); |
| 461 | 460 |
| 462 if (verbose) { | 461 if (verbose) { |
| 463 printf("Sample rate: %d Hz\n", sample_rate_hz); | 462 printf("Sample rate: %d Hz\n", sample_rate_hz); |
| 464 printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n", | 463 printf("Primary channels: %" PRIuS " (in), %" PRIuS " (out)\n", |
| 465 num_capture_input_channels, | 464 num_capture_input_channels, |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 } // namespace | 1155 } // namespace |
| 1157 } // namespace webrtc | 1156 } // namespace webrtc |
| 1158 | 1157 |
| 1159 int main(int argc, char* argv[]) { | 1158 int main(int argc, char* argv[]) { |
| 1160 webrtc::void_main(argc, argv); | 1159 webrtc::void_main(argc, argv); |
| 1161 | 1160 |
| 1162 // Optional, but removes memory leak noise from Valgrind. | 1161 // Optional, but removes memory leak noise from Valgrind. |
| 1163 google::protobuf::ShutdownProtobufLibrary(); | 1162 google::protobuf::ShutdownProtobufLibrary(); |
| 1164 return 0; | 1163 return 0; |
| 1165 } | 1164 } |
| OLD | NEW |