andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | // Commandline tool to unpack audioproc debug files. |
| 12 | // |
| 13 | // The debug files are dumped as protobuf blobs. For analysis, it's necessary |
| 14 | // to unpack the file into its component parts: audio and other data. |
| 15 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 16 | #include <inttypes.h> |
| 17 | #include <stdint.h> |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 18 | #include <stdio.h> |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 19 | #include <stdlib.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 20 | |
kwiberg | 62eaacf | 2016-02-17 06:39:05 -0800 | [diff] [blame] | 21 | #include <memory> |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 22 | #include <string> |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 23 | #include <vector> |
kwiberg | 62eaacf | 2016-02-17 06:39:05 -0800 | [diff] [blame] | 24 | |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 25 | #include "absl/flags/flag.h" |
| 26 | #include "absl/flags/parse.h" |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 27 | #include "api/function_view.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 28 | #include "common_audio/wav_file.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 29 | #include "modules/audio_processing/test/protobuf_utils.h" |
| 30 | #include "modules/audio_processing/test/test_utils.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 31 | #include "rtc_base/format_macros.h" |
| 32 | #include "rtc_base/ignore_wundef.h" |
Jonas Olsson | 366a50c | 2018-09-06 13:41:30 +0200 | [diff] [blame] | 33 | #include "rtc_base/strings/string_builder.h" |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 34 | |
kwiberg | 77eab70 | 2016-09-28 17:42:01 -0700 | [diff] [blame] | 35 | RTC_PUSH_IGNORING_WUNDEF() |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 36 | #include "modules/audio_processing/debug.pb.h" |
kwiberg | 77eab70 | 2016-09-28 17:42:01 -0700 | [diff] [blame] | 37 | RTC_POP_IGNORING_WUNDEF() |
| 38 | |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 39 | ABSL_FLAG(std::string, |
| 40 | input_file, |
| 41 | "input", |
| 42 | "The name of the input stream file."); |
| 43 | ABSL_FLAG(std::string, |
| 44 | output_file, |
| 45 | "ref_out", |
| 46 | "The name of the reference output stream file."); |
| 47 | ABSL_FLAG(std::string, |
| 48 | reverse_file, |
| 49 | "reverse", |
| 50 | "The name of the reverse input stream file."); |
| 51 | ABSL_FLAG(std::string, |
| 52 | delay_file, |
| 53 | "delay.int32", |
| 54 | "The name of the delay file."); |
| 55 | ABSL_FLAG(std::string, |
| 56 | drift_file, |
| 57 | "drift.int32", |
| 58 | "The name of the drift file."); |
| 59 | ABSL_FLAG(std::string, |
| 60 | level_file, |
| 61 | "level.int32", |
| 62 | "The name of the level file."); |
| 63 | ABSL_FLAG(std::string, |
| 64 | keypress_file, |
| 65 | "keypress.bool", |
| 66 | "The name of the keypress file."); |
| 67 | ABSL_FLAG(std::string, |
| 68 | callorder_file, |
| 69 | "callorder", |
| 70 | "The name of the render/capture call order file."); |
| 71 | ABSL_FLAG(std::string, |
| 72 | settings_file, |
| 73 | "settings.txt", |
| 74 | "The name of the settings file."); |
| 75 | ABSL_FLAG(bool, |
| 76 | full, |
| 77 | false, |
| 78 | "Unpack the full set of files (normally not needed)."); |
| 79 | ABSL_FLAG(bool, raw, false, "Write raw data instead of a WAV file."); |
| 80 | ABSL_FLAG(bool, |
| 81 | text, |
| 82 | false, |
| 83 | "Write non-audio files as text files instead of binary files."); |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 84 | ABSL_FLAG(bool, |
| 85 | use_init_suffix, |
| 86 | false, |
| 87 | "Use init index instead of capture frame count as file name suffix."); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 88 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 89 | #define PRINT_CONFIG(field_name) \ |
| 90 | if (msg.has_##field_name()) { \ |
Minyue | 13b96ba | 2015-10-03 00:39:14 +0200 | [diff] [blame] | 91 | fprintf(settings_file, " " #field_name ": %d\n", msg.field_name()); \ |
| 92 | } |
| 93 | |
Alex Loiko | 5feb30e | 2018-04-16 13:52:32 +0200 | [diff] [blame] | 94 | #define PRINT_CONFIG_FLOAT(field_name) \ |
| 95 | if (msg.has_##field_name()) { \ |
| 96 | fprintf(settings_file, " " #field_name ": %f\n", msg.field_name()); \ |
| 97 | } |
| 98 | |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 99 | namespace webrtc { |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 100 | |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 101 | using audioproc::Event; |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 102 | using audioproc::Init; |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 103 | using audioproc::ReverseStream; |
| 104 | using audioproc::Stream; |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 105 | |
Sam Zackrisson | f61475d | 2018-05-11 11:34:49 +0200 | [diff] [blame] | 106 | namespace { |
| 107 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 108 | void WriteData(const void* data, |
| 109 | size_t size, |
| 110 | FILE* file, |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 111 | const std::string& filename) { |
| 112 | if (fwrite(data, size, 1, file) != 1) { |
| 113 | printf("Error when writing to %s\n", filename.c_str()); |
| 114 | exit(1); |
| 115 | } |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 116 | } |
| 117 | |
Sam Zackrisson | f61475d | 2018-05-11 11:34:49 +0200 | [diff] [blame] | 118 | void WriteCallOrderData(const bool render_call, |
| 119 | FILE* file, |
| 120 | const std::string& filename) { |
| 121 | const char call_type = render_call ? 'r' : 'c'; |
| 122 | WriteData(&call_type, sizeof(call_type), file, filename.c_str()); |
| 123 | } |
| 124 | |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 125 | bool WritingCallOrderFile() { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 126 | return absl::GetFlag(FLAGS_full); |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 127 | } |
| 128 | |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 129 | bool WritingRuntimeSettingFiles() { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 130 | return absl::GetFlag(FLAGS_full); |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | // Exports RuntimeSetting AEC dump events to Audacity-readable files. |
| 134 | // This class is not RAII compliant. |
| 135 | class RuntimeSettingWriter { |
| 136 | public: |
| 137 | RuntimeSettingWriter( |
| 138 | std::string name, |
| 139 | rtc::FunctionView<bool(const Event)> is_exporter_for, |
| 140 | rtc::FunctionView<std::string(const Event)> get_timeline_label) |
| 141 | : setting_name_(std::move(name)), |
| 142 | is_exporter_for_(is_exporter_for), |
| 143 | get_timeline_label_(get_timeline_label) {} |
| 144 | ~RuntimeSettingWriter() { Flush(); } |
| 145 | |
| 146 | bool IsExporterFor(const Event& event) const { |
| 147 | return is_exporter_for_(event); |
| 148 | } |
| 149 | |
Artem Titov | 54500ad | 2021-07-26 15:51:27 +0200 | [diff] [blame] | 150 | // Writes to file the payload of `event` using `frame_count` to calculate |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 151 | // timestamp. |
| 152 | void WriteEvent(const Event& event, int frame_count) { |
| 153 | RTC_DCHECK(is_exporter_for_(event)); |
| 154 | if (file_ == nullptr) { |
| 155 | rtc::StringBuilder file_name; |
| 156 | file_name << setting_name_ << frame_offset_ << ".txt"; |
| 157 | file_ = OpenFile(file_name.str(), "wb"); |
| 158 | } |
| 159 | |
| 160 | // Time in the current WAV file, in seconds. |
| 161 | double time = (frame_count - frame_offset_) / 100.0; |
| 162 | std::string label = get_timeline_label_(event); |
| 163 | // In Audacity, all annotations are encoded as intervals. |
| 164 | fprintf(file_, "%.6f\t%.6f\t%s \n", time, time, label.c_str()); |
| 165 | } |
| 166 | |
| 167 | // Handles an AEC dump initialization event, occurring at frame |
Artem Titov | 54500ad | 2021-07-26 15:51:27 +0200 | [diff] [blame] | 168 | // `frame_offset`. |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 169 | void HandleInitEvent(int frame_offset) { |
| 170 | Flush(); |
| 171 | frame_offset_ = frame_offset; |
| 172 | } |
| 173 | |
| 174 | private: |
| 175 | void Flush() { |
| 176 | if (file_ != nullptr) { |
| 177 | fclose(file_); |
| 178 | file_ = nullptr; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | FILE* file_ = nullptr; |
| 183 | int frame_offset_ = 0; |
| 184 | const std::string setting_name_; |
| 185 | const rtc::FunctionView<bool(Event)> is_exporter_for_; |
| 186 | const rtc::FunctionView<std::string(Event)> get_timeline_label_; |
| 187 | }; |
| 188 | |
| 189 | // Returns RuntimeSetting exporters for runtime setting types defined in |
| 190 | // debug.proto. |
| 191 | std::vector<RuntimeSettingWriter> RuntimeSettingWriters() { |
| 192 | return { |
| 193 | RuntimeSettingWriter( |
| 194 | "CapturePreGain", |
| 195 | [](const Event& event) -> bool { |
| 196 | return event.runtime_setting().has_capture_pre_gain(); |
| 197 | }, |
| 198 | [](const Event& event) -> std::string { |
| 199 | return std::to_string(event.runtime_setting().capture_pre_gain()); |
| 200 | }), |
| 201 | RuntimeSettingWriter( |
| 202 | "CustomRenderProcessingRuntimeSetting", |
| 203 | [](const Event& event) -> bool { |
| 204 | return event.runtime_setting() |
| 205 | .has_custom_render_processing_setting(); |
| 206 | }, |
| 207 | [](const Event& event) -> std::string { |
| 208 | return std::to_string( |
| 209 | event.runtime_setting().custom_render_processing_setting()); |
| 210 | }), |
| 211 | RuntimeSettingWriter( |
| 212 | "CaptureFixedPostGain", |
| 213 | [](const Event& event) -> bool { |
| 214 | return event.runtime_setting().has_capture_fixed_post_gain(); |
| 215 | }, |
| 216 | [](const Event& event) -> std::string { |
| 217 | return std::to_string( |
| 218 | event.runtime_setting().capture_fixed_post_gain()); |
| 219 | }), |
| 220 | RuntimeSettingWriter( |
| 221 | "PlayoutVolumeChange", |
| 222 | [](const Event& event) -> bool { |
| 223 | return event.runtime_setting().has_playout_volume_change(); |
| 224 | }, |
| 225 | [](const Event& event) -> std::string { |
| 226 | return std::to_string( |
| 227 | event.runtime_setting().playout_volume_change()); |
| 228 | })}; |
| 229 | } |
| 230 | |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 231 | std::string GetWavFileIndex(int init_index, int frame_count) { |
| 232 | rtc::StringBuilder suffix; |
| 233 | if (absl::GetFlag(FLAGS_use_init_suffix)) { |
| 234 | suffix << "_" << init_index; |
| 235 | } else { |
| 236 | suffix << frame_count; |
| 237 | } |
| 238 | return suffix.str(); |
| 239 | } |
| 240 | |
Sam Zackrisson | f61475d | 2018-05-11 11:34:49 +0200 | [diff] [blame] | 241 | } // namespace |
| 242 | |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 243 | int do_main(int argc, char* argv[]) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 244 | std::vector<char*> args = absl::ParseCommandLine(argc, argv); |
| 245 | std::string program_name = args[0]; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 246 | std::string usage = |
| 247 | "Commandline tool to unpack audioproc debug files.\n" |
| 248 | "Example usage:\n" + |
| 249 | program_name + " debug_dump.pb\n"; |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 250 | |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 251 | if (args.size() < 2) { |
oprypin | 6e09d87 | 2017-08-31 03:21:39 -0700 | [diff] [blame] | 252 | printf("%s", usage.c_str()); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 253 | return 1; |
| 254 | } |
| 255 | |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 256 | FILE* debug_file = OpenFile(args[1], "rb"); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 257 | |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 258 | Event event_msg; |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 259 | int frame_count = 0; |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 260 | int init_count = 0; |
pkasting | 25702cb | 2016-01-08 13:50:27 -0800 | [diff] [blame] | 261 | size_t reverse_samples_per_channel = 0; |
| 262 | size_t input_samples_per_channel = 0; |
| 263 | size_t output_samples_per_channel = 0; |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 264 | size_t num_reverse_channels = 0; |
| 265 | size_t num_input_channels = 0; |
| 266 | size_t num_output_channels = 0; |
kwiberg | 62eaacf | 2016-02-17 06:39:05 -0800 | [diff] [blame] | 267 | std::unique_ptr<WavWriter> reverse_wav_file; |
| 268 | std::unique_ptr<WavWriter> input_wav_file; |
| 269 | std::unique_ptr<WavWriter> output_wav_file; |
| 270 | std::unique_ptr<RawFile> reverse_raw_file; |
| 271 | std::unique_ptr<RawFile> input_raw_file; |
| 272 | std::unique_ptr<RawFile> output_raw_file; |
Minyue | 13b96ba | 2015-10-03 00:39:14 +0200 | [diff] [blame] | 273 | |
Jonas Olsson | 366a50c | 2018-09-06 13:41:30 +0200 | [diff] [blame] | 274 | rtc::StringBuilder callorder_raw_name; |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 275 | callorder_raw_name << absl::GetFlag(FLAGS_callorder_file) << ".char"; |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 276 | FILE* callorder_char_file = WritingCallOrderFile() |
| 277 | ? OpenFile(callorder_raw_name.str(), "wb") |
| 278 | : nullptr; |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 279 | FILE* settings_file = OpenFile(absl::GetFlag(FLAGS_settings_file), "wb"); |
Minyue | 13b96ba | 2015-10-03 00:39:14 +0200 | [diff] [blame] | 280 | |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 281 | std::vector<RuntimeSettingWriter> runtime_setting_writers = |
| 282 | RuntimeSettingWriters(); |
| 283 | |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 284 | while (ReadMessageFromFile(debug_file, &event_msg)) { |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 285 | if (event_msg.type() == Event::REVERSE_STREAM) { |
| 286 | if (!event_msg.has_reverse_stream()) { |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 287 | printf("Corrupt input file: ReverseStream missing.\n"); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 288 | return 1; |
| 289 | } |
| 290 | |
| 291 | const ReverseStream msg = event_msg.reverse_stream(); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 292 | if (msg.has_data()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 293 | if (absl::GetFlag(FLAGS_raw) && !reverse_raw_file) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 294 | reverse_raw_file.reset( |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 295 | new RawFile(absl::GetFlag(FLAGS_reverse_file) + ".pcm")); |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 296 | } |
aluebs@webrtc.org | bac0726 | 2014-09-03 13:39:01 +0000 | [diff] [blame] | 297 | // TODO(aluebs): Replace "num_reverse_channels * |
| 298 | // reverse_samples_per_channel" with "msg.data().size() / |
| 299 | // sizeof(int16_t)" and so on when this fix in audio_processing has made |
| 300 | // it into stable: https://webrtc-codereview.appspot.com/15299004/ |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 301 | WriteIntData(reinterpret_cast<const int16_t*>(msg.data().data()), |
aluebs@webrtc.org | bac0726 | 2014-09-03 13:39:01 +0000 | [diff] [blame] | 302 | num_reverse_channels * reverse_samples_per_channel, |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 303 | reverse_wav_file.get(), reverse_raw_file.get()); |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 304 | } else if (msg.channel_size() > 0) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 305 | if (absl::GetFlag(FLAGS_raw) && !reverse_raw_file) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 306 | reverse_raw_file.reset( |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 307 | new RawFile(absl::GetFlag(FLAGS_reverse_file) + ".float")); |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 308 | } |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 309 | std::unique_ptr<const float*[]> data( |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 310 | new const float*[num_reverse_channels]); |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 311 | for (size_t i = 0; i < num_reverse_channels; ++i) { |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 312 | data[i] = reinterpret_cast<const float*>(msg.channel(i).data()); |
| 313 | } |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 314 | WriteFloatData(data.get(), reverse_samples_per_channel, |
| 315 | num_reverse_channels, reverse_wav_file.get(), |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 316 | reverse_raw_file.get()); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 317 | } |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 318 | if (absl::GetFlag(FLAGS_full)) { |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 319 | if (WritingCallOrderFile()) { |
| 320 | WriteCallOrderData(true /* render_call */, callorder_char_file, |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 321 | absl::GetFlag(FLAGS_callorder_file)); |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 322 | } |
Sam Zackrisson | f61475d | 2018-05-11 11:34:49 +0200 | [diff] [blame] | 323 | } |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 324 | } else if (event_msg.type() == Event::STREAM) { |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 325 | frame_count++; |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 326 | if (!event_msg.has_stream()) { |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 327 | printf("Corrupt input file: Stream missing.\n"); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 328 | return 1; |
| 329 | } |
| 330 | |
| 331 | const Stream msg = event_msg.stream(); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 332 | if (msg.has_input_data()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 333 | if (absl::GetFlag(FLAGS_raw) && !input_raw_file) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 334 | input_raw_file.reset( |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 335 | new RawFile(absl::GetFlag(FLAGS_input_file) + ".pcm")); |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 336 | } |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 337 | WriteIntData(reinterpret_cast<const int16_t*>(msg.input_data().data()), |
aluebs@webrtc.org | bac0726 | 2014-09-03 13:39:01 +0000 | [diff] [blame] | 338 | num_input_channels * input_samples_per_channel, |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 339 | input_wav_file.get(), input_raw_file.get()); |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 340 | } else if (msg.input_channel_size() > 0) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 341 | if (absl::GetFlag(FLAGS_raw) && !input_raw_file) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 342 | input_raw_file.reset( |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 343 | new RawFile(absl::GetFlag(FLAGS_input_file) + ".float")); |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 344 | } |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 345 | std::unique_ptr<const float*[]> data( |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 346 | new const float*[num_input_channels]); |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 347 | for (size_t i = 0; i < num_input_channels; ++i) { |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 348 | data[i] = reinterpret_cast<const float*>(msg.input_channel(i).data()); |
| 349 | } |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 350 | WriteFloatData(data.get(), input_samples_per_channel, |
| 351 | num_input_channels, input_wav_file.get(), |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 352 | input_raw_file.get()); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 353 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 354 | |
| 355 | if (msg.has_output_data()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 356 | if (absl::GetFlag(FLAGS_raw) && !output_raw_file) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 357 | output_raw_file.reset( |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 358 | new RawFile(absl::GetFlag(FLAGS_output_file) + ".pcm")); |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 359 | } |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 360 | WriteIntData(reinterpret_cast<const int16_t*>(msg.output_data().data()), |
aluebs@webrtc.org | bac0726 | 2014-09-03 13:39:01 +0000 | [diff] [blame] | 361 | num_output_channels * output_samples_per_channel, |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 362 | output_wav_file.get(), output_raw_file.get()); |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 363 | } else if (msg.output_channel_size() > 0) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 364 | if (absl::GetFlag(FLAGS_raw) && !output_raw_file) { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 365 | output_raw_file.reset( |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 366 | new RawFile(absl::GetFlag(FLAGS_output_file) + ".float")); |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 367 | } |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 368 | std::unique_ptr<const float*[]> data( |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 369 | new const float*[num_output_channels]); |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 370 | for (size_t i = 0; i < num_output_channels; ++i) { |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 371 | data[i] = |
| 372 | reinterpret_cast<const float*>(msg.output_channel(i).data()); |
| 373 | } |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 374 | WriteFloatData(data.get(), output_samples_per_channel, |
| 375 | num_output_channels, output_wav_file.get(), |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 376 | output_raw_file.get()); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 377 | } |
| 378 | |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 379 | if (absl::GetFlag(FLAGS_full)) { |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 380 | if (WritingCallOrderFile()) { |
| 381 | WriteCallOrderData(false /* render_call */, callorder_char_file, |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 382 | absl::GetFlag(FLAGS_callorder_file)); |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 383 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 384 | if (msg.has_delay()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 385 | static FILE* delay_file = |
| 386 | OpenFile(absl::GetFlag(FLAGS_delay_file), "wb"); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 387 | int32_t delay = msg.delay(); |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 388 | if (absl::GetFlag(FLAGS_text)) { |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 389 | fprintf(delay_file, "%d\n", delay); |
| 390 | } else { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 391 | WriteData(&delay, sizeof(delay), delay_file, |
| 392 | absl::GetFlag(FLAGS_delay_file)); |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 393 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 394 | } |
| 395 | |
| 396 | if (msg.has_drift()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 397 | static FILE* drift_file = |
| 398 | OpenFile(absl::GetFlag(FLAGS_drift_file), "wb"); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 399 | int32_t drift = msg.drift(); |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 400 | if (absl::GetFlag(FLAGS_text)) { |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 401 | fprintf(drift_file, "%d\n", drift); |
| 402 | } else { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 403 | WriteData(&drift, sizeof(drift), drift_file, |
| 404 | absl::GetFlag(FLAGS_drift_file)); |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 405 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | if (msg.has_level()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 409 | static FILE* level_file = |
| 410 | OpenFile(absl::GetFlag(FLAGS_level_file), "wb"); |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 411 | int32_t level = msg.level(); |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 412 | if (absl::GetFlag(FLAGS_text)) { |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 413 | fprintf(level_file, "%d\n", level); |
| 414 | } else { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 415 | WriteData(&level, sizeof(level), level_file, |
| 416 | absl::GetFlag(FLAGS_level_file)); |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 417 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 418 | } |
andrew@webrtc.org | ce8e077 | 2014-02-12 15:28:30 +0000 | [diff] [blame] | 419 | |
| 420 | if (msg.has_keypress()) { |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 421 | static FILE* keypress_file = |
| 422 | OpenFile(absl::GetFlag(FLAGS_keypress_file), "wb"); |
andrew@webrtc.org | ce8e077 | 2014-02-12 15:28:30 +0000 | [diff] [blame] | 423 | bool keypress = msg.keypress(); |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 424 | if (absl::GetFlag(FLAGS_text)) { |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 425 | fprintf(keypress_file, "%d\n", keypress); |
| 426 | } else { |
| 427 | WriteData(&keypress, sizeof(keypress), keypress_file, |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 428 | absl::GetFlag(FLAGS_keypress_file)); |
Bjorn Volcker | 40a6d59 | 2015-05-06 10:51:34 +0200 | [diff] [blame] | 429 | } |
andrew@webrtc.org | ce8e077 | 2014-02-12 15:28:30 +0000 | [diff] [blame] | 430 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 431 | } |
Minyue | 13b96ba | 2015-10-03 00:39:14 +0200 | [diff] [blame] | 432 | } else if (event_msg.type() == Event::CONFIG) { |
| 433 | if (!event_msg.has_config()) { |
| 434 | printf("Corrupt input file: Config missing.\n"); |
| 435 | return 1; |
| 436 | } |
| 437 | const audioproc::Config msg = event_msg.config(); |
| 438 | |
| 439 | fprintf(settings_file, "APM re-config at frame: %d\n", frame_count); |
| 440 | |
| 441 | PRINT_CONFIG(aec_enabled); |
| 442 | PRINT_CONFIG(aec_delay_agnostic_enabled); |
| 443 | PRINT_CONFIG(aec_drift_compensation_enabled); |
| 444 | PRINT_CONFIG(aec_extended_filter_enabled); |
| 445 | PRINT_CONFIG(aec_suppression_level); |
| 446 | PRINT_CONFIG(aecm_enabled); |
| 447 | PRINT_CONFIG(aecm_comfort_noise_enabled); |
| 448 | PRINT_CONFIG(aecm_routing_mode); |
| 449 | PRINT_CONFIG(agc_enabled); |
| 450 | PRINT_CONFIG(agc_mode); |
| 451 | PRINT_CONFIG(agc_limiter_enabled); |
| 452 | PRINT_CONFIG(noise_robust_agc_enabled); |
| 453 | PRINT_CONFIG(hpf_enabled); |
| 454 | PRINT_CONFIG(ns_enabled); |
| 455 | PRINT_CONFIG(ns_level); |
| 456 | PRINT_CONFIG(transient_suppression_enabled); |
Alex Loiko | 5feb30e | 2018-04-16 13:52:32 +0200 | [diff] [blame] | 457 | PRINT_CONFIG(pre_amplifier_enabled); |
| 458 | PRINT_CONFIG_FLOAT(pre_amplifier_fixed_gain_factor); |
| 459 | |
peah | 7789fe7 | 2016-04-15 01:19:44 -0700 | [diff] [blame] | 460 | if (msg.has_experiments_description()) { |
| 461 | fprintf(settings_file, " experiments_description: %s\n", |
| 462 | msg.experiments_description().c_str()); |
| 463 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 464 | } else if (event_msg.type() == Event::INIT) { |
| 465 | if (!event_msg.has_init()) { |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 466 | printf("Corrupt input file: Init missing.\n"); |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 467 | return 1; |
| 468 | } |
| 469 | |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 470 | ++init_count; |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 471 | const Init msg = event_msg.init(); |
| 472 | // These should print out zeros if they're missing. |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 473 | fprintf(settings_file, "Init #%d at frame: %d\n", init_count, |
| 474 | frame_count); |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 475 | int input_sample_rate = msg.sample_rate(); |
| 476 | fprintf(settings_file, " Input sample rate: %d\n", input_sample_rate); |
| 477 | int output_sample_rate = msg.output_sample_rate(); |
| 478 | fprintf(settings_file, " Output sample rate: %d\n", output_sample_rate); |
| 479 | int reverse_sample_rate = msg.reverse_sample_rate(); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 480 | fprintf(settings_file, " Reverse sample rate: %d\n", |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 481 | reverse_sample_rate); |
| 482 | num_input_channels = msg.num_input_channels(); |
Oleh Prypin | b168678 | 2019-08-02 09:36:47 +0200 | [diff] [blame] | 483 | fprintf(settings_file, " Input channels: %" RTC_PRIuS "\n", |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 484 | num_input_channels); |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 485 | num_output_channels = msg.num_output_channels(); |
Oleh Prypin | b168678 | 2019-08-02 09:36:47 +0200 | [diff] [blame] | 486 | fprintf(settings_file, " Output channels: %" RTC_PRIuS "\n", |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 487 | num_output_channels); |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 488 | num_reverse_channels = msg.num_reverse_channels(); |
Oleh Prypin | b168678 | 2019-08-02 09:36:47 +0200 | [diff] [blame] | 489 | fprintf(settings_file, " Reverse channels: %" RTC_PRIuS "\n", |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 490 | num_reverse_channels); |
Minyue Li | 656d609 | 2018-08-10 15:38:52 +0200 | [diff] [blame] | 491 | if (msg.has_timestamp_ms()) { |
| 492 | const int64_t timestamp = msg.timestamp_ms(); |
| 493 | fprintf(settings_file, " Timestamp in millisecond: %" PRId64 "\n", |
| 494 | timestamp); |
| 495 | } |
andrew@webrtc.org | cd82438 | 2011-11-11 19:13:36 +0000 | [diff] [blame] | 496 | |
| 497 | fprintf(settings_file, "\n"); |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 498 | |
| 499 | if (reverse_sample_rate == 0) { |
| 500 | reverse_sample_rate = input_sample_rate; |
| 501 | } |
| 502 | if (output_sample_rate == 0) { |
| 503 | output_sample_rate = input_sample_rate; |
| 504 | } |
| 505 | |
pkasting | 25702cb | 2016-01-08 13:50:27 -0800 | [diff] [blame] | 506 | reverse_samples_per_channel = |
| 507 | static_cast<size_t>(reverse_sample_rate / 100); |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 508 | input_samples_per_channel = static_cast<size_t>(input_sample_rate / 100); |
pkasting | 25702cb | 2016-01-08 13:50:27 -0800 | [diff] [blame] | 509 | output_samples_per_channel = |
| 510 | static_cast<size_t>(output_sample_rate / 100); |
aluebs@webrtc.org | bac0726 | 2014-09-03 13:39:01 +0000 | [diff] [blame] | 511 | |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 512 | if (!absl::GetFlag(FLAGS_raw)) { |
aluebs@webrtc.org | 021e76f | 2014-09-04 18:12:00 +0000 | [diff] [blame] | 513 | // The WAV files need to be reset every time, because they cant change |
| 514 | // their sample rate or number of channels. |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 515 | |
| 516 | std::string suffix = GetWavFileIndex(init_count, frame_count); |
Jonas Olsson | 366a50c | 2018-09-06 13:41:30 +0200 | [diff] [blame] | 517 | rtc::StringBuilder reverse_name; |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 518 | reverse_name << absl::GetFlag(FLAGS_reverse_file) << suffix << ".wav"; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 519 | reverse_wav_file.reset(new WavWriter( |
| 520 | reverse_name.str(), reverse_sample_rate, num_reverse_channels)); |
Jonas Olsson | 366a50c | 2018-09-06 13:41:30 +0200 | [diff] [blame] | 521 | rtc::StringBuilder input_name; |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 522 | input_name << absl::GetFlag(FLAGS_input_file) << suffix << ".wav"; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 523 | input_wav_file.reset(new WavWriter(input_name.str(), input_sample_rate, |
andrew@webrtc.org | a3ed713 | 2014-10-31 21:51:03 +0000 | [diff] [blame] | 524 | num_input_channels)); |
Jonas Olsson | 366a50c | 2018-09-06 13:41:30 +0200 | [diff] [blame] | 525 | rtc::StringBuilder output_name; |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 526 | output_name << absl::GetFlag(FLAGS_output_file) << suffix << ".wav"; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 527 | output_wav_file.reset(new WavWriter( |
| 528 | output_name.str(), output_sample_rate, num_output_channels)); |
Sam Zackrisson | f61475d | 2018-05-11 11:34:49 +0200 | [diff] [blame] | 529 | |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 530 | if (WritingCallOrderFile()) { |
| 531 | rtc::StringBuilder callorder_name; |
Per Åhgren | 879d33b | 2021-01-21 10:08:15 +0100 | [diff] [blame] | 532 | callorder_name << absl::GetFlag(FLAGS_callorder_file) << suffix |
Mirko Bonadei | 9d96209 | 2019-07-04 10:19:10 +0200 | [diff] [blame] | 533 | << ".char"; |
Per Åhgren | c1bfe1a | 2018-09-21 16:23:50 +0200 | [diff] [blame] | 534 | callorder_char_file = OpenFile(callorder_name.str(), "wb"); |
| 535 | } |
Fredrik Hernqvist | 3be9da3 | 2019-05-21 12:23:31 +0200 | [diff] [blame] | 536 | |
| 537 | if (WritingRuntimeSettingFiles()) { |
| 538 | for (RuntimeSettingWriter& writer : runtime_setting_writers) { |
| 539 | writer.HandleInitEvent(frame_count); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | } else if (event_msg.type() == Event::RUNTIME_SETTING) { |
| 544 | if (WritingRuntimeSettingFiles()) { |
| 545 | for (RuntimeSettingWriter& writer : runtime_setting_writers) { |
| 546 | if (writer.IsExporterFor(event_msg)) { |
| 547 | writer.WriteEvent(event_msg, frame_count); |
| 548 | } |
| 549 | } |
aluebs@webrtc.org | 841f58f | 2014-09-02 07:51:51 +0000 | [diff] [blame] | 550 | } |
andrew@webrtc.org | cb18121 | 2011-10-26 00:27:17 +0000 | [diff] [blame] | 551 | } |
| 552 | } |
| 553 | |
| 554 | return 0; |
| 555 | } |
andrew@webrtc.org | a8b9737 | 2014-03-10 22:26:12 +0000 | [diff] [blame] | 556 | |
| 557 | } // namespace webrtc |
| 558 | |
| 559 | int main(int argc, char* argv[]) { |
| 560 | return webrtc::do_main(argc, argv); |
| 561 | } |