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..2f9d28741944d46e2d2ed82775eb61ac06918900 100644 |
| --- a/webrtc/modules/audio_processing/test/unpack.cc |
| +++ b/webrtc/modules/audio_processing/test/unpack.cc |
| @@ -40,6 +40,16 @@ DEFINE_bool(text, |
| false, |
| "Write non-audio files as text files instead of binary files."); |
| +inline void print_config(FILE* settings_file, |
|
peah-webrtc
2015/10/02 08:34:28
Is this really a proper filename according to the
minyue-webrtc
2015/10/02 09:01:42
This part has been changed back to Andrew's early
peah-webrtc
2015/10/02 09:18:29
Acknowledged.
|
| + bool config_exist, |
| + int config_value, |
| + const std::string& config_descriptor) { |
| + if (config_exist) { |
| + fprintf(settings_file, " %s: %d\n", config_descriptor.c_str(), |
| + config_value); |
| + } |
| +} |
| + |
| namespace webrtc { |
| using audioproc::Event; |
| @@ -83,6 +93,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"); |
|
peah-webrtc
2015/10/02 08:34:27
This is something that holds for the version curre
minyue-webrtc
2015/10/02 09:01:42
Yes, could you help me find a place to add a close
peah-webrtc
2015/10/02 09:18:29
I'd just add a close of the settings_file and debu
|
| + |
| while (ReadMessageFromFile(debug_file, &event_msg)) { |
| if (event_msg.type() == Event::REVERSE_STREAM) { |
| if (!event_msg.has_reverse_stream()) { |
| @@ -217,13 +230,58 @@ 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(settings_file, msg.has_aec_enabled(), msg.aec_enabled(), |
| + "AEC enabled"); |
| + print_config(settings_file, msg.has_aec_delay_agnostic(), |
| + msg.aec_delay_agnostic(), "AEC delay agnostic enabled"); |
| + print_config(settings_file, msg.has_aec_drift_compensation(), |
| + msg.aec_drift_compensation(), |
| + "AEC drift compensation enabled"); |
| + print_config(settings_file, msg.has_aec_extended_filter(), |
| + msg.aec_extended_filter(), "AEC extended filter enabled"); |
| + print_config(settings_file, msg.has_aec_suppression_level(), |
| + msg.aec_suppression_level(), "AEC suppression level"); |
| + // AECM. |
| + print_config(settings_file, msg.has_aecm_enabled(), msg.aecm_enabled(), |
| + "AECM enabled"); |
| + print_config(settings_file, msg.has_aecm_comfort_noise(), |
| + msg.aecm_comfort_noise(), "AECM comfort noise enabled"); |
| + print_config(settings_file, msg.has_aecm_routing_mode(), |
| + msg.aecm_routing_mode(), "AECM routing mode"); |
| + // AGC. |
| + print_config(settings_file, msg.has_agc_enabled(), msg.agc_enabled(), |
| + "AGC enabled"); |
| + print_config(settings_file, msg.has_agc_experiment(), |
| + msg.agc_experiment(), "AGC experiment enabled"); |
| + print_config(settings_file, msg.has_agc_mode(), msg.agc_mode(), |
| + "AGC mode"); |
| + print_config(settings_file, msg.has_agc_limiter(), msg.agc_limiter(), |
| + "AGC limiter enabled"); |
| + // HPF. |
| + print_config(settings_file, msg.has_hpf_enabled(), msg.hpf_enabled(), |
| + "HPF enabled"); |
| + // NS. |
| + print_config(settings_file, msg.has_ns_enabled(), msg.ns_enabled(), |
| + "NS enabled"); |
| + print_config(settings_file, msg.has_ns_experiment(), msg.ns_experiment(), |
| + "NS experiment enabled"); |
| + print_config(settings_file, msg.has_ns_level(), msg.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); |