OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
| 11 #include <string.h> |
| 12 |
11 #include <iostream> | 13 #include <iostream> |
12 #include <memory> | 14 #include <memory> |
13 | 15 |
14 #include <string.h> | |
15 | |
16 #include "gflags/gflags.h" | 16 #include "gflags/gflags.h" |
17 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
18 #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h" | 18 #include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h" |
19 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h" | 19 #include "webrtc/modules/audio_processing/test/audio_processing_simulator.h" |
20 #include "webrtc/modules/audio_processing/test/wav_based_simulator.h" | 20 #include "webrtc/modules/audio_processing/test/wav_based_simulator.h" |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 namespace test { | 23 namespace test { |
24 namespace { | 24 namespace { |
25 | 25 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 "Specify the VAD likelihood (0-3)"); | 154 "Specify the VAD likelihood (0-3)"); |
155 DEFINE_int32(ns_level, | 155 DEFINE_int32(ns_level, |
156 kParameterNotSpecifiedValue, | 156 kParameterNotSpecifiedValue, |
157 "Specify the NS level (0-3)"); | 157 "Specify the NS level (0-3)"); |
158 DEFINE_int32(stream_delay, | 158 DEFINE_int32(stream_delay, |
159 kParameterNotSpecifiedValue, | 159 kParameterNotSpecifiedValue, |
160 "Specify the stream delay in ms to use"); | 160 "Specify the stream delay in ms to use"); |
161 DEFINE_int32(stream_drift_samples, | 161 DEFINE_int32(stream_drift_samples, |
162 kParameterNotSpecifiedValue, | 162 kParameterNotSpecifiedValue, |
163 "Specify the number of stream drift samples to use"); | 163 "Specify the number of stream drift samples to use"); |
| 164 DEFINE_int32(initial_mic_level, |
| 165 100, |
| 166 "Initial mic level (0-255)"); |
| 167 DEFINE_bool(simulate_mic_gain, |
| 168 false, |
| 169 "Simulate adjustable microphone analog gain"); |
| 170 DEFINE_int32(simulated_mic_kind, |
| 171 kParameterNotSpecifiedValue, |
| 172 "Specify which microphone kind to use for microphone simulation"); |
164 DEFINE_bool(performance_report, false, "Report the APM performance "); | 173 DEFINE_bool(performance_report, false, "Report the APM performance "); |
165 DEFINE_bool(verbose, false, "Produce verbose output"); | 174 DEFINE_bool(verbose, false, "Produce verbose output"); |
166 DEFINE_bool(bitexactness_report, | 175 DEFINE_bool(bitexactness_report, |
167 false, | 176 false, |
168 "Report bitexactness for aec dump result reproduction"); | 177 "Report bitexactness for aec dump result reproduction"); |
169 DEFINE_bool(discard_settings_in_aecdump, | 178 DEFINE_bool(discard_settings_in_aecdump, |
170 false, | 179 false, |
171 "Discard any config settings specified in the aec dump"); | 180 "Discard any config settings specified in the aec dump"); |
172 DEFINE_bool(store_intermediate_output, | 181 DEFINE_bool(store_intermediate_output, |
173 false, | 182 false, |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); | 270 SetSettingIfFlagSet(FLAGS_agc_limiter, &settings.use_agc_limiter); |
262 SetSettingIfSpecified(FLAGS_agc_compression_gain, | 271 SetSettingIfSpecified(FLAGS_agc_compression_gain, |
263 &settings.agc_compression_gain); | 272 &settings.agc_compression_gain); |
264 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); | 273 SetSettingIfSpecified(FLAGS_vad_likelihood, &settings.vad_likelihood); |
265 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); | 274 SetSettingIfSpecified(FLAGS_ns_level, &settings.ns_level); |
266 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); | 275 SetSettingIfSpecified(FLAGS_stream_delay, &settings.stream_delay); |
267 SetSettingIfSpecified(FLAGS_stream_drift_samples, | 276 SetSettingIfSpecified(FLAGS_stream_drift_samples, |
268 &settings.stream_drift_samples); | 277 &settings.stream_drift_samples); |
269 SetSettingIfSpecified(FLAGS_custom_call_order_file, | 278 SetSettingIfSpecified(FLAGS_custom_call_order_file, |
270 &settings.custom_call_order_filename); | 279 &settings.custom_call_order_filename); |
| 280 settings.initial_mic_level = FLAGS_initial_mic_level; |
| 281 settings.simulate_mic_gain = FLAGS_simulate_mic_gain; |
| 282 SetSettingIfSpecified(FLAGS_simulated_mic_kind, &settings.simulated_mic_kind); |
271 settings.report_performance = FLAGS_performance_report; | 283 settings.report_performance = FLAGS_performance_report; |
272 settings.use_verbose_logging = FLAGS_verbose; | 284 settings.use_verbose_logging = FLAGS_verbose; |
273 settings.report_bitexactness = FLAGS_bitexactness_report; | 285 settings.report_bitexactness = FLAGS_bitexactness_report; |
274 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump; | 286 settings.discard_all_settings_in_aecdump = FLAGS_discard_settings_in_aecdump; |
275 settings.fixed_interface = FLAGS_fixed_interface; | 287 settings.fixed_interface = FLAGS_fixed_interface; |
276 settings.store_intermediate_output = FLAGS_store_intermediate_output; | 288 settings.store_intermediate_output = FLAGS_store_intermediate_output; |
277 | 289 |
278 return settings; | 290 return settings; |
279 } | 291 } |
280 | 292 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 ReportConditionalErrorAndExit( | 389 ReportConditionalErrorAndExit( |
378 settings.report_bitexactness && !settings.aec_dump_input_filename, | 390 settings.report_bitexactness && !settings.aec_dump_input_filename, |
379 "Error: --bitexactness_report can only be used when operating on an " | 391 "Error: --bitexactness_report can only be used when operating on an " |
380 "aecdump\n"); | 392 "aecdump\n"); |
381 | 393 |
382 ReportConditionalErrorAndExit( | 394 ReportConditionalErrorAndExit( |
383 settings.custom_call_order_filename && settings.aec_dump_input_filename, | 395 settings.custom_call_order_filename && settings.aec_dump_input_filename, |
384 "Error: --custom_call_order_file cannot be used when operating on an " | 396 "Error: --custom_call_order_file cannot be used when operating on an " |
385 "aecdump\n"); | 397 "aecdump\n"); |
386 | 398 |
| 399 ReportConditionalErrorAndExit( |
| 400 (settings.initial_mic_level < 0 || settings.initial_mic_level > 255), |
| 401 "Error: --initial_mic_level must be specified between 0 and 255.\n"); |
| 402 |
| 403 ReportConditionalErrorAndExit( |
| 404 settings.simulated_mic_kind && !settings.simulate_mic_gain, |
| 405 "Error: --simulated_mic_kind cannot be specified when mic simulation is " |
| 406 "disabled\n"); |
| 407 |
| 408 ReportConditionalErrorAndExit( |
| 409 !settings.simulated_mic_kind && settings.simulate_mic_gain, |
| 410 "Error: --simulated_mic_kind must be specified when mic simulation is " |
| 411 "enabled\n"); |
| 412 |
387 auto valid_wav_name = [](const std::string& wav_file_name) { | 413 auto valid_wav_name = [](const std::string& wav_file_name) { |
388 if (wav_file_name.size() < 5) { | 414 if (wav_file_name.size() < 5) { |
389 return false; | 415 return false; |
390 } | 416 } |
391 if ((wav_file_name.compare(wav_file_name.size() - 4, 4, ".wav") == 0) || | 417 if ((wav_file_name.compare(wav_file_name.size() - 4, 4, ".wav") == 0) || |
392 (wav_file_name.compare(wav_file_name.size() - 4, 4, ".WAV") == 0)) { | 418 (wav_file_name.compare(wav_file_name.size() - 4, 4, ".WAV") == 0)) { |
393 return true; | 419 return true; |
394 } | 420 } |
395 return false; | 421 return false; |
396 }; | 422 }; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 488 |
463 return 0; | 489 return 0; |
464 } | 490 } |
465 | 491 |
466 } // namespace test | 492 } // namespace test |
467 } // namespace webrtc | 493 } // namespace webrtc |
468 | 494 |
469 int main(int argc, char* argv[]) { | 495 int main(int argc, char* argv[]) { |
470 return webrtc::test::main(argc, argv); | 496 return webrtc::test::main(argc, argv); |
471 } | 497 } |
OLD | NEW |