Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 int output_samples_per_channel = 0; | 76 int output_samples_per_channel = 0; |
| 77 int num_reverse_channels = 0; | 77 int num_reverse_channels = 0; |
| 78 int num_input_channels = 0; | 78 int num_input_channels = 0; |
| 79 int num_output_channels = 0; | 79 int num_output_channels = 0; |
| 80 rtc::scoped_ptr<WavWriter> reverse_wav_file; | 80 rtc::scoped_ptr<WavWriter> reverse_wav_file; |
| 81 rtc::scoped_ptr<WavWriter> input_wav_file; | 81 rtc::scoped_ptr<WavWriter> input_wav_file; |
| 82 rtc::scoped_ptr<WavWriter> output_wav_file; | 82 rtc::scoped_ptr<WavWriter> output_wav_file; |
| 83 rtc::scoped_ptr<RawFile> reverse_raw_file; | 83 rtc::scoped_ptr<RawFile> reverse_raw_file; |
| 84 rtc::scoped_ptr<RawFile> input_raw_file; | 84 rtc::scoped_ptr<RawFile> input_raw_file; |
| 85 rtc::scoped_ptr<RawFile> output_raw_file; | 85 rtc::scoped_ptr<RawFile> output_raw_file; |
| 86 | |
| 87 FILE* settings_file = OpenFile(FLAGS_settings_file, "wb"); | |
| 88 | |
| 86 while (ReadMessageFromFile(debug_file, &event_msg)) { | 89 while (ReadMessageFromFile(debug_file, &event_msg)) { |
| 87 if (event_msg.type() == Event::REVERSE_STREAM) { | 90 if (event_msg.type() == Event::REVERSE_STREAM) { |
| 88 if (!event_msg.has_reverse_stream()) { | 91 if (!event_msg.has_reverse_stream()) { |
| 89 printf("Corrupt input file: ReverseStream missing.\n"); | 92 printf("Corrupt input file: ReverseStream missing.\n"); |
| 90 return 1; | 93 return 1; |
| 91 } | 94 } |
| 92 | 95 |
| 93 const ReverseStream msg = event_msg.reverse_stream(); | 96 const ReverseStream msg = event_msg.reverse_stream(); |
| 94 if (msg.has_data()) { | 97 if (msg.has_data()) { |
| 95 if (FLAGS_raw && !reverse_raw_file) { | 98 if (FLAGS_raw && !reverse_raw_file) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 static FILE* keypress_file = OpenFile(FLAGS_keypress_file, "wb"); | 213 static FILE* keypress_file = OpenFile(FLAGS_keypress_file, "wb"); |
| 211 bool keypress = msg.keypress(); | 214 bool keypress = msg.keypress(); |
| 212 if (FLAGS_text) { | 215 if (FLAGS_text) { |
| 213 fprintf(keypress_file, "%d\n", keypress); | 216 fprintf(keypress_file, "%d\n", keypress); |
| 214 } else { | 217 } else { |
| 215 WriteData(&keypress, sizeof(keypress), keypress_file, | 218 WriteData(&keypress, sizeof(keypress), keypress_file, |
| 216 FLAGS_keypress_file); | 219 FLAGS_keypress_file); |
| 217 } | 220 } |
| 218 } | 221 } |
| 219 } | 222 } |
| 223 } else if (event_msg.type() == Event::CONFIG) { | |
| 224 if (!event_msg.has_config()) { | |
| 225 printf("Corrupt input file: Config missing.\n"); | |
| 226 return 1; | |
| 227 } | |
| 228 const audioproc::Config msg = event_msg.config(); | |
| 229 | |
| 230 fprintf(settings_file, "APM re-config at frame: %d\n", frame_count); | |
| 231 if (msg.has_aec_enabled()) { | |
|
Andrew MacDonald
2015/09/26 02:36:20
Might be cooler to use a macro for this:
#define
minyue-webrtc
2015/09/26 16:26:44
yes I like a macro, much easier to read and mainta
| |
| 232 fprintf(settings_file, " AEC enabled: %d\n", msg.aec_enabled()); | |
| 233 } | |
| 234 if (msg.has_aec_delay_agnostic()) { | |
| 235 fprintf(settings_file, " AEC delay agnostic: %d\n", | |
| 236 msg.aec_delay_agnostic()); | |
| 237 } | |
| 238 if (msg.has_aec_drift_compensation()) { | |
| 239 fprintf(settings_file, " AEC drift compensation: %d\n", | |
| 240 msg.aec_drift_compensation()); | |
| 241 } | |
| 242 if (msg.has_aec_extended_filter()) { | |
| 243 fprintf(settings_file, " AEC extended filter: %d\n", | |
| 244 msg.aec_extended_filter()); | |
| 245 } | |
| 246 if (msg.has_aec_suppression_level()) { | |
| 247 fprintf(settings_file, " AEC suppression level: %d\n", | |
| 248 msg.aec_suppression_level()); | |
| 249 } | |
| 250 if (msg.has_aecm_enabled()) { | |
| 251 fprintf(settings_file, " AECM enabled: %d\n", msg.aecm_enabled()); | |
| 252 } | |
| 253 if (msg.has_aecm_comfort_noise()) { | |
| 254 fprintf(settings_file, " AECM comfort noise: %d\n", | |
| 255 msg.aecm_comfort_noise()); | |
| 256 } | |
| 257 if (msg.has_aecm_routing_mode()) { | |
| 258 fprintf(settings_file, " AECM routing mode: %d\n", | |
| 259 msg.aecm_routing_mode()); | |
| 260 } | |
| 261 if (msg.has_agc_enabled()) { | |
| 262 fprintf(settings_file, " AGC enabled: %d\n", msg.agc_enabled()); | |
| 263 } | |
| 264 if (msg.has_agc_experiment()) { | |
| 265 fprintf(settings_file, " AGC experiment: %d\n", msg.agc_experiment()); | |
| 266 } | |
| 267 if (msg.has_agc_mode()) { | |
| 268 fprintf(settings_file, " AGC mode: %d\n", msg.agc_mode()); | |
| 269 } | |
| 270 if (msg.has_agc_limiter()) { | |
| 271 fprintf(settings_file, " AGC limiter: %d\n", msg.agc_limiter()); | |
| 272 } | |
| 273 if (msg.has_hpf_enabled()) { | |
| 274 fprintf(settings_file, " HPF enabled: %d\n", msg.hpf_enabled()); | |
| 275 } | |
| 276 if (msg.has_ns_enabled()) { | |
| 277 fprintf(settings_file, " NS enabled: %d\n", msg.ns_enabled()); | |
| 278 } | |
| 279 if (msg.has_ns_experiment()) { | |
| 280 fprintf(settings_file, " NS experiment: %d\n", msg.ns_experiment()); | |
| 281 } | |
| 282 if (msg.has_ns_level()) { | |
| 283 fprintf(settings_file, " NS level: %d\n", msg. ns_level()); | |
| 284 } | |
| 220 } else if (event_msg.type() == Event::INIT) { | 285 } else if (event_msg.type() == Event::INIT) { |
| 221 if (!event_msg.has_init()) { | 286 if (!event_msg.has_init()) { |
| 222 printf("Corrupt input file: Init missing.\n"); | 287 printf("Corrupt input file: Init missing.\n"); |
| 223 return 1; | 288 return 1; |
| 224 } | 289 } |
| 225 | 290 |
| 226 static FILE* settings_file = OpenFile(FLAGS_settings_file, "wb"); | |
| 227 const Init msg = event_msg.init(); | 291 const Init msg = event_msg.init(); |
| 228 // These should print out zeros if they're missing. | 292 // These should print out zeros if they're missing. |
| 229 fprintf(settings_file, "Init at frame: %d\n", frame_count); | 293 fprintf(settings_file, "Init at frame: %d\n", frame_count); |
| 230 int input_sample_rate = msg.sample_rate(); | 294 int input_sample_rate = msg.sample_rate(); |
| 231 fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate); | 295 fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate); |
| 232 int output_sample_rate = msg.output_sample_rate(); | 296 int output_sample_rate = msg.output_sample_rate(); |
| 233 fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate); | 297 fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate); |
| 234 int reverse_sample_rate = msg.reverse_sample_rate(); | 298 int reverse_sample_rate = msg.reverse_sample_rate(); |
| 235 fprintf(settings_file, | 299 fprintf(settings_file, |
| 236 " Reverse sample rate: %d\n", | 300 " Reverse sample rate: %d\n", |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 } | 336 } |
| 273 | 337 |
| 274 return 0; | 338 return 0; |
| 275 } | 339 } |
| 276 | 340 |
| 277 } // namespace webrtc | 341 } // namespace webrtc |
| 278 | 342 |
| 279 int main(int argc, char* argv[]) { | 343 int main(int argc, char* argv[]) { |
| 280 return webrtc::do_main(argc, argv); | 344 return webrtc::do_main(argc, argv); |
| 281 } | 345 } |
| OLD | NEW |