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

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: renaming two fields 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 #define PRINT_CONFIG(field_name) \
44 if (msg.has_##field_name()) { \
45 fprintf(settings_file, " " #field_name ": %d\n", msg.field_name()); \
46 }
47
43 namespace webrtc { 48 namespace webrtc {
44 49
45 using audioproc::Event; 50 using audioproc::Event;
46 using audioproc::ReverseStream; 51 using audioproc::ReverseStream;
47 using audioproc::Stream; 52 using audioproc::Stream;
48 using audioproc::Init; 53 using audioproc::Init;
49 54
50 void WriteData(const void* data, size_t size, FILE* file, 55 void WriteData(const void* data, size_t size, FILE* file,
51 const std::string& filename) { 56 const std::string& filename) {
52 if (fwrite(data, size, 1, file) != 1) { 57 if (fwrite(data, size, 1, file) != 1) {
(...skipping 23 matching lines...) Expand all
76 int output_samples_per_channel = 0; 81 int output_samples_per_channel = 0;
77 int num_reverse_channels = 0; 82 int num_reverse_channels = 0;
78 int num_input_channels = 0; 83 int num_input_channels = 0;
79 int num_output_channels = 0; 84 int num_output_channels = 0;
80 rtc::scoped_ptr<WavWriter> reverse_wav_file; 85 rtc::scoped_ptr<WavWriter> reverse_wav_file;
81 rtc::scoped_ptr<WavWriter> input_wav_file; 86 rtc::scoped_ptr<WavWriter> input_wav_file;
82 rtc::scoped_ptr<WavWriter> output_wav_file; 87 rtc::scoped_ptr<WavWriter> output_wav_file;
83 rtc::scoped_ptr<RawFile> reverse_raw_file; 88 rtc::scoped_ptr<RawFile> reverse_raw_file;
84 rtc::scoped_ptr<RawFile> input_raw_file; 89 rtc::scoped_ptr<RawFile> input_raw_file;
85 rtc::scoped_ptr<RawFile> output_raw_file; 90 rtc::scoped_ptr<RawFile> output_raw_file;
91
92 FILE* settings_file = OpenFile(FLAGS_settings_file, "wb");
93
86 while (ReadMessageFromFile(debug_file, &event_msg)) { 94 while (ReadMessageFromFile(debug_file, &event_msg)) {
87 if (event_msg.type() == Event::REVERSE_STREAM) { 95 if (event_msg.type() == Event::REVERSE_STREAM) {
88 if (!event_msg.has_reverse_stream()) { 96 if (!event_msg.has_reverse_stream()) {
89 printf("Corrupt input file: ReverseStream missing.\n"); 97 printf("Corrupt input file: ReverseStream missing.\n");
90 return 1; 98 return 1;
91 } 99 }
92 100
93 const ReverseStream msg = event_msg.reverse_stream(); 101 const ReverseStream msg = event_msg.reverse_stream();
94 if (msg.has_data()) { 102 if (msg.has_data()) {
95 if (FLAGS_raw && !reverse_raw_file) { 103 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"); 218 static FILE* keypress_file = OpenFile(FLAGS_keypress_file, "wb");
211 bool keypress = msg.keypress(); 219 bool keypress = msg.keypress();
212 if (FLAGS_text) { 220 if (FLAGS_text) {
213 fprintf(keypress_file, "%d\n", keypress); 221 fprintf(keypress_file, "%d\n", keypress);
214 } else { 222 } else {
215 WriteData(&keypress, sizeof(keypress), keypress_file, 223 WriteData(&keypress, sizeof(keypress), keypress_file,
216 FLAGS_keypress_file); 224 FLAGS_keypress_file);
217 } 225 }
218 } 226 }
219 } 227 }
228 } else if (event_msg.type() == Event::CONFIG) {
229 if (!event_msg.has_config()) {
230 printf("Corrupt input file: Config missing.\n");
231 return 1;
232 }
233 const audioproc::Config msg = event_msg.config();
234
235 fprintf(settings_file, "APM re-config at frame: %d\n", frame_count);
236 // AEC.
Andrew MacDonald 2015/10/02 21:46:04 Same here, these comments are unnecessary. Use lin
minyue-webrtc 2015/10/02 21:57:34 Done.
237 PRINT_CONFIG(aec_enabled);
238 PRINT_CONFIG(aec_delay_agnostic_enabled);
239 PRINT_CONFIG(aec_drift_compensation_enabled);
240 PRINT_CONFIG(aec_extended_filter_enabled);
241 PRINT_CONFIG(aec_suppression_level);
242 // AECM.
243 PRINT_CONFIG(aecm_enabled);
244 PRINT_CONFIG(aecm_comfort_noise_enabled);
245 PRINT_CONFIG(aecm_routing_mode);
246 // AGC.
247 PRINT_CONFIG(agc_enabled);
248 PRINT_CONFIG(agc_noise_robust_enabled);
249 PRINT_CONFIG(agc_mode);
250 PRINT_CONFIG(agc_limiter_enabled);
251 // HPF.
252 PRINT_CONFIG(hpf_enabled);
253 // NS.
254 PRINT_CONFIG(ns_enabled);
255 PRINT_CONFIG(ns_level);
256 // Transient suppression.
257 PRINT_CONFIG(transient_suppression_enabled);
220 } else if (event_msg.type() == Event::INIT) { 258 } else if (event_msg.type() == Event::INIT) {
221 if (!event_msg.has_init()) { 259 if (!event_msg.has_init()) {
222 printf("Corrupt input file: Init missing.\n"); 260 printf("Corrupt input file: Init missing.\n");
223 return 1; 261 return 1;
224 } 262 }
225 263
226 static FILE* settings_file = OpenFile(FLAGS_settings_file, "wb");
227 const Init msg = event_msg.init(); 264 const Init msg = event_msg.init();
228 // These should print out zeros if they're missing. 265 // These should print out zeros if they're missing.
229 fprintf(settings_file, "Init at frame: %d\n", frame_count); 266 fprintf(settings_file, "Init at frame: %d\n", frame_count);
230 int input_sample_rate = msg.sample_rate(); 267 int input_sample_rate = msg.sample_rate();
231 fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate); 268 fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate);
232 int output_sample_rate = msg.output_sample_rate(); 269 int output_sample_rate = msg.output_sample_rate();
233 fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate); 270 fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate);
234 int reverse_sample_rate = msg.reverse_sample_rate(); 271 int reverse_sample_rate = msg.reverse_sample_rate();
235 fprintf(settings_file, 272 fprintf(settings_file,
236 " Reverse sample rate: %d\n", 273 " Reverse sample rate: %d\n",
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 309 }
273 310
274 return 0; 311 return 0;
275 } 312 }
276 313
277 } // namespace webrtc 314 } // namespace webrtc
278 315
279 int main(int argc, char* argv[]) { 316 int main(int argc, char* argv[]) {
280 return webrtc::do_main(argc, argv); 317 return webrtc::do_main(argc, argv);
281 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698