Chromium Code Reviews| Index: webrtc/modules/audio_processing/test/unpack.cc |
| diff --git a/webrtc/modules/audio_processing/test/unpack.cc b/webrtc/modules/audio_processing/test/unpack.cc |
| index 2484828bd18662ea1bb5ae15306dd0adcd28719f..23b6cad45285a171f0d66079e8b0be47b4a52cd2 100644 |
| --- a/webrtc/modules/audio_processing/test/unpack.cc |
| +++ b/webrtc/modules/audio_processing/test/unpack.cc |
| @@ -40,6 +40,11 @@ DEFINE_bool(text, |
| false, |
| "Write non-audio files as text files instead of binary files."); |
| +#define PRINT_CONFIG(field_name, descriptor) \ |
| + if (msg.has_##field_name()) { \ |
| + fprintf(settings_file, " " descriptor ": %d\n", msg.field_name()); \ |
| + } |
| + |
| namespace webrtc { |
| using audioproc::Event; |
| @@ -83,6 +88,9 @@ int do_main(int argc, char* argv[]) { |
| rtc::scoped_ptr<RawFile> reverse_raw_file; |
| rtc::scoped_ptr<RawFile> input_raw_file; |
| rtc::scoped_ptr<RawFile> output_raw_file; |
| + |
| + FILE* settings_file = OpenFile(FLAGS_settings_file, "wb"); |
| + |
| while (ReadMessageFromFile(debug_file, &event_msg)) { |
| if (event_msg.type() == Event::REVERSE_STREAM) { |
| if (!event_msg.has_reverse_stream()) { |
| @@ -217,13 +225,41 @@ int do_main(int argc, char* argv[]) { |
| } |
| } |
| } |
| + } else if (event_msg.type() == Event::CONFIG) { |
| + if (!event_msg.has_config()) { |
| + printf("Corrupt input file: Config missing.\n"); |
| + return 1; |
| + } |
| + const audioproc::Config msg = event_msg.config(); |
| + |
| + fprintf(settings_file, "APM re-config at frame: %d\n", frame_count); |
| + // AEC. |
| + PRINT_CONFIG(aec_enabled, "AEC enabled"); |
|
Andrew MacDonald
2015/10/01 06:33:28
I wouldn't add the second string parameter here. T
minyue-webrtc
2015/10/01 20:18:26
Ok. I think it is better to use inline function th
Andrew MacDonald
2015/10/02 00:37:20
Why not just have the macro "stringify" the single
minyue-webrtc
2015/10/02 05:29:01
Because I think the variable name is not sufficien
Andrew MacDonald
2015/10/02 06:07:39
I'm more concerned about the code being clear than
|
| + PRINT_CONFIG(aec_delay_agnostic, "AEC delay agnostic enabled"); |
| + PRINT_CONFIG(aec_drift_compensation, "AEC drift compensation enabled"); |
| + PRINT_CONFIG(aec_extended_filter, "AEC extended filter enabled"); |
| + PRINT_CONFIG(aec_suppression_level, "AEC suppression level"); |
| + // AECM. |
| + PRINT_CONFIG(aecm_enabled, "AECM enabled"); |
| + PRINT_CONFIG(aecm_comfort_noise, "AECM comfort noise enabled"); |
| + PRINT_CONFIG(aecm_routing_mode, "AECM routing mode"); |
| + // AGC. |
| + PRINT_CONFIG(agc_enabled, "AGC enabled"); |
| + PRINT_CONFIG(agc_experiment, "AGC experiment enabled"); |
| + PRINT_CONFIG(agc_mode, "AGC mode"); |
| + PRINT_CONFIG(agc_limiter, "AGC limiter enabled"); |
| + // HPF. |
| + PRINT_CONFIG(hpf_enabled, "HPF enabled"); |
| + // NS. |
| + PRINT_CONFIG(ns_enabled, "NS enabled"); |
| + PRINT_CONFIG(ns_experiment, "NS experiment enabled"); |
| + PRINT_CONFIG(ns_level, "NS Level"); |
| } else if (event_msg.type() == Event::INIT) { |
| if (!event_msg.has_init()) { |
| printf("Corrupt input file: Init missing.\n"); |
| return 1; |
| } |
| - static FILE* settings_file = OpenFile(FLAGS_settings_file, "wb"); |
| const Init msg = event_msg.init(); |
| // These should print out zeros if they're missing. |
| fprintf(settings_file, "Init at frame: %d\n", frame_count); |