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

Unified Diff: webrtc/modules/audio_processing/test/audioproc_float.cc

Issue 2834643002: audioproc_f with simulated mic analog gain (Closed)
Patch Set: comments addressed Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/audioproc_float.cc
diff --git a/webrtc/modules/audio_processing/test/audioproc_float.cc b/webrtc/modules/audio_processing/test/audioproc_float.cc
index 9f1abc430d88747d161c8ad260e151614a769311..bb5893daa2e15fec93d3fb0aff572d98c275dab1 100644
--- a/webrtc/modules/audio_processing/test/audioproc_float.cc
+++ b/webrtc/modules/audio_processing/test/audioproc_float.cc
@@ -8,11 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <string.h>
+
#include <iostream>
#include <memory>
-#include <string.h>
-
#include "gflags/gflags.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/audio_processing/test/aec_dump_based_simulator.h"
@@ -158,6 +158,15 @@ DEFINE_int32(stream_delay,
DEFINE_int32(stream_drift_samples,
kParameterNotSpecifiedValue,
"Specify the number of stream drift samples to use");
+DEFINE_int32(initial_mic_gain,
+ 100,
+ "Initial mic gain level (0-255)");
+DEFINE_bool(simulate_mic_gain,
+ false,
+ "Simulate adjustable microphone analog gain");
+DEFINE_int32(simulated_mic_kind,
+ kParameterNotSpecifiedValue,
+ "Specify which microphone kind to use for microphone simulation");
DEFINE_bool(performance_report, false, "Report the APM performance ");
DEFINE_bool(verbose, false, "Produce verbose output");
DEFINE_bool(bitexactness_report,
@@ -264,6 +273,9 @@ SimulationSettings CreateSettings() {
&settings.stream_drift_samples);
SetSettingIfSpecified(FLAGS_custom_call_order_file,
&settings.custom_call_order_filename);
+ settings.initial_mic_gain = FLAGS_initial_mic_gain;
+ settings.simulate_mic_gain = FLAGS_simulate_mic_gain;
+ SetSettingIfSpecified(FLAGS_simulated_mic_kind, &settings.simulated_mic_kind);
settings.report_performance = FLAGS_performance_report;
settings.use_verbose_logging = FLAGS_verbose;
settings.report_bitexactness = FLAGS_bitexactness_report;
@@ -380,6 +392,20 @@ void PerformBasicParameterSanityChecks(const SimulationSettings& settings) {
"Error: --custom_call_order_file cannot be used when operating on an "
"aecdump\n");
+ ReportConditionalErrorAndExit(
+ (settings.initial_mic_gain < 0 || settings.initial_mic_gain > 255),
+ "Error: --initial_mic_gain must be specified between 0 and 255.\n");
+
+ ReportConditionalErrorAndExit(
+ settings.simulated_mic_kind && !settings.simulate_mic_gain,
+ "Error: --simulated_mic_kind cannot be specified when mic simulation is "
+ "disabled\n");
+
+ ReportConditionalErrorAndExit(
+ !settings.simulated_mic_kind && settings.simulate_mic_gain,
+ "Error: --simulated_mic_kind must be specified when mic simulation is "
+ "enabled\n");
+
auto valid_wav_name = [](const std::string& wav_file_name) {
if (wav_file_name.size() < 5) {
return false;

Powered by Google App Engine
This is Rietveld 408576698