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

Side by Side Diff: webrtc/modules/audio_processing/test/unpack.cc

Issue 1348903004: Adding APM configuration in AEC dump. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removing macro and more Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 22 matching lines...) Expand all
33 DEFINE_string(level_file, "level.int32", "The name of the level file."); 33 DEFINE_string(level_file, "level.int32", "The name of the level file.");
34 DEFINE_string(keypress_file, "keypress.bool", "The name of the keypress file."); 34 DEFINE_string(keypress_file, "keypress.bool", "The name of the keypress file.");
35 DEFINE_string(settings_file, "settings.txt", "The name of the settings file."); 35 DEFINE_string(settings_file, "settings.txt", "The name of the settings file.");
36 DEFINE_bool(full, false, 36 DEFINE_bool(full, false,
37 "Unpack the full set of files (normally not needed)."); 37 "Unpack the full set of files (normally not needed).");
38 DEFINE_bool(raw, false, "Write raw data instead of a WAV file."); 38 DEFINE_bool(raw, false, "Write raw data instead of a WAV file.");
39 DEFINE_bool(text, 39 DEFINE_bool(text,
40 false, 40 false,
41 "Write non-audio files as text files instead of binary files."); 41 "Write non-audio files as text files instead of binary files.");
42 42
43 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.
44 bool config_exist,
45 int config_value,
46 const std::string& config_descriptor) {
47 if (config_exist) {
48 fprintf(settings_file, " %s: %d\n", config_descriptor.c_str(),
49 config_value);
50 }
51 }
52
43 namespace webrtc { 53 namespace webrtc {
44 54
45 using audioproc::Event; 55 using audioproc::Event;
46 using audioproc::ReverseStream; 56 using audioproc::ReverseStream;
47 using audioproc::Stream; 57 using audioproc::Stream;
48 using audioproc::Init; 58 using audioproc::Init;
49 59
50 void WriteData(const void* data, size_t size, FILE* file, 60 void WriteData(const void* data, size_t size, FILE* file,
51 const std::string& filename) { 61 const std::string& filename) {
52 if (fwrite(data, size, 1, file) != 1) { 62 if (fwrite(data, size, 1, file) != 1) {
(...skipping 23 matching lines...) Expand all
76 int output_samples_per_channel = 0; 86 int output_samples_per_channel = 0;
77 int num_reverse_channels = 0; 87 int num_reverse_channels = 0;
78 int num_input_channels = 0; 88 int num_input_channels = 0;
79 int num_output_channels = 0; 89 int num_output_channels = 0;
80 rtc::scoped_ptr<WavWriter> reverse_wav_file; 90 rtc::scoped_ptr<WavWriter> reverse_wav_file;
81 rtc::scoped_ptr<WavWriter> input_wav_file; 91 rtc::scoped_ptr<WavWriter> input_wav_file;
82 rtc::scoped_ptr<WavWriter> output_wav_file; 92 rtc::scoped_ptr<WavWriter> output_wav_file;
83 rtc::scoped_ptr<RawFile> reverse_raw_file; 93 rtc::scoped_ptr<RawFile> reverse_raw_file;
84 rtc::scoped_ptr<RawFile> input_raw_file; 94 rtc::scoped_ptr<RawFile> input_raw_file;
85 rtc::scoped_ptr<RawFile> output_raw_file; 95 rtc::scoped_ptr<RawFile> output_raw_file;
96
97 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
98
86 while (ReadMessageFromFile(debug_file, &event_msg)) { 99 while (ReadMessageFromFile(debug_file, &event_msg)) {
87 if (event_msg.type() == Event::REVERSE_STREAM) { 100 if (event_msg.type() == Event::REVERSE_STREAM) {
88 if (!event_msg.has_reverse_stream()) { 101 if (!event_msg.has_reverse_stream()) {
89 printf("Corrupt input file: ReverseStream missing.\n"); 102 printf("Corrupt input file: ReverseStream missing.\n");
90 return 1; 103 return 1;
91 } 104 }
92 105
93 const ReverseStream msg = event_msg.reverse_stream(); 106 const ReverseStream msg = event_msg.reverse_stream();
94 if (msg.has_data()) { 107 if (msg.has_data()) {
95 if (FLAGS_raw && !reverse_raw_file) { 108 if (FLAGS_raw && !reverse_raw_file) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 static FILE* keypress_file = OpenFile(FLAGS_keypress_file, "wb"); 223 static FILE* keypress_file = OpenFile(FLAGS_keypress_file, "wb");
211 bool keypress = msg.keypress(); 224 bool keypress = msg.keypress();
212 if (FLAGS_text) { 225 if (FLAGS_text) {
213 fprintf(keypress_file, "%d\n", keypress); 226 fprintf(keypress_file, "%d\n", keypress);
214 } else { 227 } else {
215 WriteData(&keypress, sizeof(keypress), keypress_file, 228 WriteData(&keypress, sizeof(keypress), keypress_file,
216 FLAGS_keypress_file); 229 FLAGS_keypress_file);
217 } 230 }
218 } 231 }
219 } 232 }
233 } else if (event_msg.type() == Event::CONFIG) {
234 if (!event_msg.has_config()) {
235 printf("Corrupt input file: Config missing.\n");
236 return 1;
237 }
238 const audioproc::Config msg = event_msg.config();
239
240 fprintf(settings_file, "APM re-config at frame: %d\n", frame_count);
241 // AEC.
242 print_config(settings_file, msg.has_aec_enabled(), msg.aec_enabled(),
243 "AEC enabled");
244 print_config(settings_file, msg.has_aec_delay_agnostic(),
245 msg.aec_delay_agnostic(), "AEC delay agnostic enabled");
246 print_config(settings_file, msg.has_aec_drift_compensation(),
247 msg.aec_drift_compensation(),
248 "AEC drift compensation enabled");
249 print_config(settings_file, msg.has_aec_extended_filter(),
250 msg.aec_extended_filter(), "AEC extended filter enabled");
251 print_config(settings_file, msg.has_aec_suppression_level(),
252 msg.aec_suppression_level(), "AEC suppression level");
253 // AECM.
254 print_config(settings_file, msg.has_aecm_enabled(), msg.aecm_enabled(),
255 "AECM enabled");
256 print_config(settings_file, msg.has_aecm_comfort_noise(),
257 msg.aecm_comfort_noise(), "AECM comfort noise enabled");
258 print_config(settings_file, msg.has_aecm_routing_mode(),
259 msg.aecm_routing_mode(), "AECM routing mode");
260 // AGC.
261 print_config(settings_file, msg.has_agc_enabled(), msg.agc_enabled(),
262 "AGC enabled");
263 print_config(settings_file, msg.has_agc_experiment(),
264 msg.agc_experiment(), "AGC experiment enabled");
265 print_config(settings_file, msg.has_agc_mode(), msg.agc_mode(),
266 "AGC mode");
267 print_config(settings_file, msg.has_agc_limiter(), msg.agc_limiter(),
268 "AGC limiter enabled");
269 // HPF.
270 print_config(settings_file, msg.has_hpf_enabled(), msg.hpf_enabled(),
271 "HPF enabled");
272 // NS.
273 print_config(settings_file, msg.has_ns_enabled(), msg.ns_enabled(),
274 "NS enabled");
275 print_config(settings_file, msg.has_ns_experiment(), msg.ns_experiment(),
276 "NS experiment enabled");
277 print_config(settings_file, msg.has_ns_level(), msg.ns_level(),
278 "NS Level");
220 } else if (event_msg.type() == Event::INIT) { 279 } else if (event_msg.type() == Event::INIT) {
221 if (!event_msg.has_init()) { 280 if (!event_msg.has_init()) {
222 printf("Corrupt input file: Init missing.\n"); 281 printf("Corrupt input file: Init missing.\n");
223 return 1; 282 return 1;
224 } 283 }
225 284
226 static FILE* settings_file = OpenFile(FLAGS_settings_file, "wb");
227 const Init msg = event_msg.init(); 285 const Init msg = event_msg.init();
228 // These should print out zeros if they're missing. 286 // These should print out zeros if they're missing.
229 fprintf(settings_file, "Init at frame: %d\n", frame_count); 287 fprintf(settings_file, "Init at frame: %d\n", frame_count);
230 int input_sample_rate = msg.sample_rate(); 288 int input_sample_rate = msg.sample_rate();
231 fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate); 289 fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate);
232 int output_sample_rate = msg.output_sample_rate(); 290 int output_sample_rate = msg.output_sample_rate();
233 fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate); 291 fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate);
234 int reverse_sample_rate = msg.reverse_sample_rate(); 292 int reverse_sample_rate = msg.reverse_sample_rate();
235 fprintf(settings_file, 293 fprintf(settings_file,
236 " Reverse sample rate: %d\n", 294 " Reverse sample rate: %d\n",
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 330 }
273 331
274 return 0; 332 return 0;
275 } 333 }
276 334
277 } // namespace webrtc 335 } // namespace webrtc
278 336
279 int main(int argc, char* argv[]) { 337 int main(int argc, char* argv[]) {
280 return webrtc::do_main(argc, argv); 338 return webrtc::do_main(argc, argv);
281 } 339 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698