terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 | #include <iostream> |
| 12 | |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 13 | #include "logging/rtc_event_log/rtc_event_log_parser_new.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "rtc_base/flags.h" |
| 15 | #include "rtc_tools/event_log_visualizer/analyzer.h" |
| 16 | #include "rtc_tools/event_log_visualizer/plot_base.h" |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 17 | #include "rtc_tools/event_log_visualizer/plot_protobuf.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 18 | #include "rtc_tools/event_log_visualizer/plot_python.h" |
Bjorn Terelius | edab301 | 2018-01-31 17:23:40 +0100 | [diff] [blame] | 19 | #include "system_wrappers/include/field_trial_default.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 20 | #include "test/field_trial.h" |
| 21 | #include "test/testsupport/fileutils.h" |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 22 | |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 23 | DEFINE_string(plot_profile, |
| 24 | "default", |
| 25 | "A profile that selects a certain subset of the plots. Currently " |
Bjorn Terelius | 1edfff9 | 2017-10-11 13:15:19 +0200 | [diff] [blame] | 26 | "defined profiles are \"all\", \"none\", \"sendside_bwe\"," |
| 27 | "\"receiveside_bwe\" and \"default\""); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 28 | |
| 29 | DEFINE_bool(plot_incoming_packet_sizes, |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 30 | false, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 31 | "Plot bar graph showing the size of each incoming packet."); |
| 32 | DEFINE_bool(plot_outgoing_packet_sizes, |
| 33 | false, |
| 34 | "Plot bar graph showing the size of each outgoing packet."); |
| 35 | DEFINE_bool(plot_incoming_packet_count, |
| 36 | false, |
| 37 | "Plot the accumulated number of packets for each incoming stream."); |
| 38 | DEFINE_bool(plot_outgoing_packet_count, |
| 39 | false, |
| 40 | "Plot the accumulated number of packets for each outgoing stream."); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 41 | DEFINE_bool(plot_audio_playout, |
| 42 | false, |
| 43 | "Plot bar graph showing the time between each audio playout."); |
ivoc | aac9d6f | 2016-09-22 07:01:47 -0700 | [diff] [blame] | 44 | DEFINE_bool(plot_audio_level, |
| 45 | false, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 46 | "Plot line graph showing the audio level of incoming audio."); |
| 47 | DEFINE_bool(plot_incoming_sequence_number_delta, |
| 48 | false, |
| 49 | "Plot the sequence number difference between consecutive incoming " |
| 50 | "packets."); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 51 | DEFINE_bool( |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 52 | plot_incoming_delay_delta, |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 53 | false, |
| 54 | "Plot the difference in 1-way path delay between consecutive packets."); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 55 | DEFINE_bool(plot_incoming_delay, |
| 56 | true, |
| 57 | "Plot the 1-way path delay for incoming packets, normalized so " |
| 58 | "that the first packet has delay 0."); |
| 59 | DEFINE_bool(plot_incoming_loss_rate, |
| 60 | true, |
| 61 | "Compute the loss rate for incoming packets using a method that's " |
| 62 | "similar to the one used for RTCP SR and RR fraction lost. Note " |
| 63 | "that the loss rate can be negative if packets are duplicated or " |
| 64 | "reordered."); |
| 65 | DEFINE_bool(plot_incoming_bitrate, |
| 66 | true, |
| 67 | "Plot the total bitrate used by all incoming streams."); |
| 68 | DEFINE_bool(plot_outgoing_bitrate, |
| 69 | true, |
| 70 | "Plot the total bitrate used by all outgoing streams."); |
| 71 | DEFINE_bool(plot_incoming_stream_bitrate, |
| 72 | true, |
| 73 | "Plot the bitrate used by each incoming stream."); |
| 74 | DEFINE_bool(plot_outgoing_stream_bitrate, |
| 75 | true, |
| 76 | "Plot the bitrate used by each outgoing stream."); |
Bjorn Terelius | 28db266 | 2017-10-04 14:22:43 +0200 | [diff] [blame] | 77 | DEFINE_bool(plot_simulated_receiveside_bwe, |
| 78 | false, |
| 79 | "Run the receive-side bandwidth estimator with the incoming rtp " |
| 80 | "packets and plot the resulting estimate."); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 81 | DEFINE_bool(plot_simulated_sendside_bwe, |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 82 | false, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 83 | "Run the send-side bandwidth estimator with the outgoing rtp and " |
| 84 | "incoming rtcp and plot the resulting estimate."); |
stefan | c3de033 | 2016-08-02 07:22:17 -0700 | [diff] [blame] | 85 | DEFINE_bool(plot_network_delay_feedback, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 86 | true, |
stefan | c3de033 | 2016-08-02 07:22:17 -0700 | [diff] [blame] | 87 | "Compute network delay based on sent packets and the received " |
| 88 | "transport feedback."); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 89 | DEFINE_bool(plot_fraction_loss_feedback, |
| 90 | true, |
terelius | f736d23 | 2016-08-04 10:00:11 -0700 | [diff] [blame] | 91 | "Plot packet loss in percent for outgoing packets (as perceived by " |
| 92 | "the send-side bandwidth estimator)."); |
Bjorn Terelius | 0295a96 | 2017-10-25 17:42:41 +0200 | [diff] [blame] | 93 | DEFINE_bool(plot_pacer_delay, |
| 94 | false, |
| 95 | "Plot the time each sent packet has spent in the pacer (based on " |
| 96 | "the difference between the RTP timestamp and the send " |
| 97 | "timestamp)."); |
stefan | e372d3c | 2017-02-02 08:04:18 -0800 | [diff] [blame] | 98 | DEFINE_bool(plot_timestamps, |
| 99 | false, |
| 100 | "Plot the rtp timestamps of all rtp and rtcp packets over time."); |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 101 | DEFINE_bool(plot_rtcp_details, |
| 102 | false, |
| 103 | "Plot the contents of all report blocks in all sender and receiver " |
| 104 | "reports. This includes fraction lost, cumulative number of lost " |
| 105 | "packets, extended highest sequence number and time since last " |
| 106 | "received SR."); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 107 | DEFINE_bool(plot_audio_encoder_bitrate_bps, |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 108 | false, |
| 109 | "Plot the audio encoder target bitrate."); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 110 | DEFINE_bool(plot_audio_encoder_frame_length_ms, |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 111 | false, |
| 112 | "Plot the audio encoder frame length."); |
| 113 | DEFINE_bool( |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 114 | plot_audio_encoder_packet_loss, |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 115 | false, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 116 | "Plot the uplink packet loss fraction which is sent to the audio encoder."); |
| 117 | DEFINE_bool(plot_audio_encoder_fec, false, "Plot the audio encoder FEC."); |
| 118 | DEFINE_bool(plot_audio_encoder_dtx, false, "Plot the audio encoder DTX."); |
| 119 | DEFINE_bool(plot_audio_encoder_num_channels, |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 120 | false, |
| 121 | "Plot the audio encoder number of channels."); |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 122 | DEFINE_bool(plot_neteq_stats, false, "Plot the NetEq statistics."); |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 123 | DEFINE_bool(plot_ice_candidate_pair_config, |
| 124 | false, |
| 125 | "Plot the ICE candidate pair config events."); |
| 126 | DEFINE_bool(plot_ice_connectivity_check, |
| 127 | false, |
| 128 | "Plot the ICE candidate pair connectivity checks."); |
Bjorn Terelius | 1edfff9 | 2017-10-11 13:15:19 +0200 | [diff] [blame] | 129 | |
stefan | 985d280 | 2016-11-15 06:54:09 -0800 | [diff] [blame] | 130 | DEFINE_string( |
| 131 | force_fieldtrials, |
| 132 | "", |
| 133 | "Field trials control experimental feature code which can be forced. " |
| 134 | "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/" |
| 135 | " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple " |
| 136 | "trials are separated by \"/\""); |
owb | 7fbeb0b | 2017-08-16 02:48:33 -0700 | [diff] [blame] | 137 | DEFINE_string(wav_filename, |
| 138 | "", |
| 139 | "Path to wav file used for simulation of jitter buffer"); |
kjellander | 4fa5be4 | 2017-05-16 00:01:23 -0700 | [diff] [blame] | 140 | DEFINE_bool(help, false, "prints this message"); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 141 | |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 142 | DEFINE_bool(show_detector_state, |
| 143 | false, |
| 144 | "Show the state of the delay based BWE detector on the total " |
| 145 | "bitrate graph"); |
| 146 | |
Ilya Nikolaevskiy | a4259f6 | 2017-12-05 13:19:45 +0100 | [diff] [blame] | 147 | DEFINE_bool(show_alr_state, |
| 148 | false, |
| 149 | "Show the state ALR state on the total bitrate graph"); |
| 150 | |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 151 | DEFINE_bool(parse_unconfigured_header_extensions, |
| 152 | true, |
| 153 | "Attempt to parse unconfigured header extensions using the default " |
| 154 | "WebRTC mapping. This can give very misleading results if the " |
| 155 | "application negotiates a different mapping."); |
| 156 | |
| 157 | DEFINE_bool(print_triage_alerts, |
| 158 | false, |
| 159 | "Print triage alerts, i.e. a list of potential problems."); |
Bjorn Terelius | 2eb3188 | 2017-11-30 15:15:25 +0100 | [diff] [blame] | 160 | |
Stefan Holmer | 1d4a227 | 2018-05-24 13:48:09 +0200 | [diff] [blame] | 161 | DEFINE_bool(normalize_time, |
| 162 | true, |
| 163 | "Normalize the log timestamps so that the call starts at time 0."); |
| 164 | |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 165 | DEFINE_bool(protobuf_output, |
| 166 | false, |
| 167 | "Output charts as protobuf instead of python code."); |
| 168 | |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 169 | void SetAllPlotFlags(bool setting); |
| 170 | |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 171 | int main(int argc, char* argv[]) { |
| 172 | std::string program_name = argv[0]; |
| 173 | std::string usage = |
| 174 | "A tool for visualizing WebRTC event logs.\n" |
| 175 | "Example usage:\n" + |
| 176 | program_name + " <logfile> | python\n" + "Run " + program_name + |
| 177 | " --help for a list of command line options\n"; |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 178 | |
| 179 | // Parse command line flags without removing them. We're only interested in |
| 180 | // the |plot_profile| flag. |
| 181 | rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false); |
| 182 | if (strcmp(FLAG_plot_profile, "all") == 0) { |
| 183 | SetAllPlotFlags(true); |
| 184 | } else if (strcmp(FLAG_plot_profile, "none") == 0) { |
| 185 | SetAllPlotFlags(false); |
Bjorn Terelius | 1edfff9 | 2017-10-11 13:15:19 +0200 | [diff] [blame] | 186 | } else if (strcmp(FLAG_plot_profile, "sendside_bwe") == 0) { |
| 187 | SetAllPlotFlags(false); |
| 188 | FLAG_plot_outgoing_packet_sizes = true; |
| 189 | FLAG_plot_outgoing_bitrate = true; |
| 190 | FLAG_plot_outgoing_stream_bitrate = true; |
| 191 | FLAG_plot_simulated_sendside_bwe = true; |
| 192 | FLAG_plot_network_delay_feedback = true; |
| 193 | FLAG_plot_fraction_loss_feedback = true; |
| 194 | } else if (strcmp(FLAG_plot_profile, "receiveside_bwe") == 0) { |
| 195 | SetAllPlotFlags(false); |
| 196 | FLAG_plot_incoming_packet_sizes = true; |
| 197 | FLAG_plot_incoming_delay_delta = true; |
| 198 | FLAG_plot_incoming_delay = true; |
| 199 | FLAG_plot_incoming_loss_rate = true; |
| 200 | FLAG_plot_incoming_bitrate = true; |
| 201 | FLAG_plot_incoming_stream_bitrate = true; |
| 202 | FLAG_plot_simulated_receiveside_bwe = true; |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 203 | } else if (strcmp(FLAG_plot_profile, "default") == 0) { |
| 204 | // Do nothing. |
| 205 | } else { |
| 206 | rtc::Flag* plot_profile_flag = rtc::FlagList::Lookup("plot_profile"); |
| 207 | RTC_CHECK(plot_profile_flag); |
| 208 | plot_profile_flag->Print(false); |
| 209 | } |
| 210 | // Parse the remaining flags. They are applied relative to the chosen profile. |
kjellander | 4fa5be4 | 2017-05-16 00:01:23 -0700 | [diff] [blame] | 211 | rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 212 | |
terelius | c4a5c14 | 2017-07-20 08:05:09 -0700 | [diff] [blame] | 213 | if (argc != 2 || FLAG_help) { |
kjellander | 4fa5be4 | 2017-05-16 00:01:23 -0700 | [diff] [blame] | 214 | // Print usage information. |
| 215 | std::cout << usage; |
terelius | c4a5c14 | 2017-07-20 08:05:09 -0700 | [diff] [blame] | 216 | if (FLAG_help) |
| 217 | rtc::FlagList::Print(nullptr, false); |
kjellander | 4fa5be4 | 2017-05-16 00:01:23 -0700 | [diff] [blame] | 218 | return 0; |
| 219 | } |
| 220 | |
henrik.lundin | 3c938fc | 2017-06-14 06:09:58 -0700 | [diff] [blame] | 221 | webrtc::test::SetExecutablePath(argv[0]); |
Bjorn Terelius | edab301 | 2018-01-31 17:23:40 +0100 | [diff] [blame] | 222 | webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials); |
| 223 | // InitFieldTrialsFromString stores the char*, so the char array must outlive |
| 224 | // the application. |
| 225 | webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials); |
stefan | 985d280 | 2016-11-15 06:54:09 -0800 | [diff] [blame] | 226 | |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 227 | std::string filename = argv[1]; |
| 228 | |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 229 | webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions header_extensions = |
| 230 | webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions::kDontParse; |
| 231 | if (FLAG_parse_unconfigured_header_extensions) { |
| 232 | header_extensions = webrtc::ParsedRtcEventLogNew:: |
| 233 | UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig; |
| 234 | } |
| 235 | webrtc::ParsedRtcEventLogNew parsed_log(header_extensions); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 236 | |
| 237 | if (!parsed_log.ParseFile(filename)) { |
| 238 | std::cerr << "Could not parse the entire log file." << std::endl; |
| 239 | std::cerr << "Proceeding to analyze the first " |
| 240 | << parsed_log.GetNumberOfEvents() << " events in the file." |
| 241 | << std::endl; |
| 242 | } |
| 243 | |
Stefan Holmer | 1d4a227 | 2018-05-24 13:48:09 +0200 | [diff] [blame] | 244 | webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time); |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 245 | std::unique_ptr<webrtc::PlotCollection> collection; |
| 246 | if (FLAG_protobuf_output) { |
| 247 | collection.reset(new webrtc::ProtobufPlotCollection()); |
| 248 | } else { |
| 249 | collection.reset(new webrtc::PythonPlotCollection()); |
| 250 | } |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 251 | |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 252 | if (FLAG_plot_incoming_packet_sizes) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 253 | analyzer.CreatePacketGraph(webrtc::kIncomingPacket, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 254 | collection->AppendNewPlot()); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 255 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 256 | if (FLAG_plot_outgoing_packet_sizes) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 257 | analyzer.CreatePacketGraph(webrtc::kOutgoingPacket, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 258 | collection->AppendNewPlot()); |
| 259 | } |
| 260 | if (FLAG_plot_incoming_packet_count) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 261 | analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket, |
| 262 | collection->AppendNewPlot()); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 263 | } |
| 264 | if (FLAG_plot_outgoing_packet_count) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 265 | analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket, |
| 266 | collection->AppendNewPlot()); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 267 | } |
| 268 | if (FLAG_plot_audio_playout) { |
terelius | dc35dcd | 2016-08-01 12:03:27 -0700 | [diff] [blame] | 269 | analyzer.CreatePlayoutGraph(collection->AppendNewPlot()); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 270 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 271 | if (FLAG_plot_audio_level) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 272 | analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket, |
| 273 | collection->AppendNewPlot()); |
| 274 | analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket, |
| 275 | collection->AppendNewPlot()); |
ivoc | aac9d6f | 2016-09-22 07:01:47 -0700 | [diff] [blame] | 276 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 277 | if (FLAG_plot_incoming_sequence_number_delta) { |
| 278 | analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot()); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 279 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 280 | if (FLAG_plot_incoming_delay_delta) { |
| 281 | analyzer.CreateIncomingDelayDeltaGraph(collection->AppendNewPlot()); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 282 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 283 | if (FLAG_plot_incoming_delay) { |
| 284 | analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot()); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 285 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 286 | if (FLAG_plot_incoming_loss_rate) { |
Stefan Holmer | 99f8e08 | 2016-09-09 13:37:50 +0200 | [diff] [blame] | 287 | analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot()); |
terelius | f736d23 | 2016-08-04 10:00:11 -0700 | [diff] [blame] | 288 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 289 | if (FLAG_plot_incoming_bitrate) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 290 | analyzer.CreateTotalIncomingBitrateGraph(collection->AppendNewPlot()); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 291 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 292 | if (FLAG_plot_outgoing_bitrate) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 293 | analyzer.CreateTotalOutgoingBitrateGraph(collection->AppendNewPlot(), |
| 294 | FLAG_show_detector_state, |
| 295 | FLAG_show_alr_state); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 296 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 297 | if (FLAG_plot_incoming_stream_bitrate) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 298 | analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 299 | collection->AppendNewPlot()); |
| 300 | } |
| 301 | if (FLAG_plot_outgoing_stream_bitrate) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 302 | analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket, |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 303 | collection->AppendNewPlot()); |
| 304 | } |
Bjorn Terelius | 28db266 | 2017-10-04 14:22:43 +0200 | [diff] [blame] | 305 | if (FLAG_plot_simulated_receiveside_bwe) { |
| 306 | analyzer.CreateReceiveSideBweSimulationGraph(collection->AppendNewPlot()); |
| 307 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 308 | if (FLAG_plot_simulated_sendside_bwe) { |
Bjorn Terelius | 28db266 | 2017-10-04 14:22:43 +0200 | [diff] [blame] | 309 | analyzer.CreateSendSideBweSimulationGraph(collection->AppendNewPlot()); |
Stefan Holmer | 1318103 | 2016-07-29 14:48:54 +0200 | [diff] [blame] | 310 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 311 | if (FLAG_plot_network_delay_feedback) { |
terelius | e34c19c | 2016-08-15 08:47:14 -0700 | [diff] [blame] | 312 | analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot()); |
stefan | c3de033 | 2016-08-02 07:22:17 -0700 | [diff] [blame] | 313 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 314 | if (FLAG_plot_fraction_loss_feedback) { |
| 315 | analyzer.CreateFractionLossGraph(collection->AppendNewPlot()); |
| 316 | } |
| 317 | if (FLAG_plot_timestamps) { |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 318 | analyzer.CreateTimestampGraph(webrtc::kIncomingPacket, |
| 319 | collection->AppendNewPlot()); |
| 320 | analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket, |
| 321 | collection->AppendNewPlot()); |
stefan | e372d3c | 2017-02-02 08:04:18 -0800 | [diff] [blame] | 322 | } |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 323 | if (FLAG_plot_rtcp_details) { |
| 324 | auto GetFractionLost = [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 325 | return static_cast<double>(block.fraction_lost()) / 256 * 100; |
| 326 | }; |
| 327 | analyzer.CreateSenderAndReceiverReportPlot( |
| 328 | webrtc::kIncomingPacket, GetFractionLost, |
| 329 | "Fraction lost (incoming RTCP)", "Loss rate (percent)", |
| 330 | collection->AppendNewPlot()); |
| 331 | analyzer.CreateSenderAndReceiverReportPlot( |
| 332 | webrtc::kOutgoingPacket, GetFractionLost, |
| 333 | "Fraction lost (outgoing RTCP)", "Loss rate (percent)", |
| 334 | collection->AppendNewPlot()); |
| 335 | |
| 336 | auto GetCumulativeLost = |
| 337 | [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 338 | return block.cumulative_lost_signed(); |
| 339 | }; |
| 340 | analyzer.CreateSenderAndReceiverReportPlot( |
| 341 | webrtc::kIncomingPacket, GetCumulativeLost, |
| 342 | "Cumulative lost packets (incoming RTCP)", "Packets", |
| 343 | collection->AppendNewPlot()); |
| 344 | analyzer.CreateSenderAndReceiverReportPlot( |
| 345 | webrtc::kOutgoingPacket, GetCumulativeLost, |
| 346 | "Cumulative lost packets (outgoing RTCP)", "Packets", |
| 347 | collection->AppendNewPlot()); |
| 348 | |
| 349 | auto GetHighestSeqNumber = |
| 350 | [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 351 | return block.extended_high_seq_num(); |
| 352 | }; |
| 353 | analyzer.CreateSenderAndReceiverReportPlot( |
| 354 | webrtc::kIncomingPacket, GetHighestSeqNumber, |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 355 | "Highest sequence number (incoming RTCP)", "Sequence number", |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 356 | collection->AppendNewPlot()); |
| 357 | analyzer.CreateSenderAndReceiverReportPlot( |
| 358 | webrtc::kOutgoingPacket, GetHighestSeqNumber, |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 359 | "Highest sequence number (outgoing RTCP)", "Sequence number", |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 360 | collection->AppendNewPlot()); |
| 361 | |
| 362 | auto DelaySinceLastSr = |
| 363 | [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 364 | return static_cast<double>(block.delay_since_last_sr()) / 65536; |
| 365 | }; |
| 366 | analyzer.CreateSenderAndReceiverReportPlot( |
| 367 | webrtc::kIncomingPacket, DelaySinceLastSr, |
| 368 | "Delay since last received sender report (incoming RTCP)", "Time (s)", |
| 369 | collection->AppendNewPlot()); |
| 370 | analyzer.CreateSenderAndReceiverReportPlot( |
| 371 | webrtc::kOutgoingPacket, DelaySinceLastSr, |
| 372 | "Delay since last received sender report (outgoing RTCP)", "Time (s)", |
| 373 | collection->AppendNewPlot()); |
| 374 | } |
| 375 | |
Bjorn Terelius | 0295a96 | 2017-10-25 17:42:41 +0200 | [diff] [blame] | 376 | if (FLAG_plot_pacer_delay) { |
| 377 | analyzer.CreatePacerDelayGraph(collection->AppendNewPlot()); |
| 378 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 379 | if (FLAG_plot_audio_encoder_bitrate_bps) { |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 380 | analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot()); |
| 381 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 382 | if (FLAG_plot_audio_encoder_frame_length_ms) { |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 383 | analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot()); |
| 384 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 385 | if (FLAG_plot_audio_encoder_packet_loss) { |
| 386 | analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot()); |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 387 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 388 | if (FLAG_plot_audio_encoder_fec) { |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 389 | analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot()); |
| 390 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 391 | if (FLAG_plot_audio_encoder_dtx) { |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 392 | analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot()); |
| 393 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 394 | if (FLAG_plot_audio_encoder_num_channels) { |
michaelt | 6e5b219 | 2017-02-22 07:33:27 -0800 | [diff] [blame] | 395 | analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot()); |
| 396 | } |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 397 | if (FLAG_plot_neteq_stats) { |
owb | 7fbeb0b | 2017-08-16 02:48:33 -0700 | [diff] [blame] | 398 | std::string wav_path; |
| 399 | if (FLAG_wav_filename[0] != '\0') { |
| 400 | wav_path = FLAG_wav_filename; |
| 401 | } else { |
| 402 | wav_path = webrtc::test::ResourcePath( |
| 403 | "audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav"); |
| 404 | } |
Minyue Li | c6ff757 | 2018-05-04 09:46:44 +0200 | [diff] [blame] | 405 | auto neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
Minyue Li | 01d2a67 | 2018-06-21 21:17:19 +0200 | [diff] [blame] | 406 | for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it = |
| 407 | neteq_stats.cbegin(); |
| 408 | it != neteq_stats.cend(); ++it) { |
| 409 | analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(), |
Minyue Li | 45fc6df | 2018-06-21 11:47:14 +0200 | [diff] [blame] | 410 | collection->AppendNewPlot()); |
| 411 | } |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 412 | analyzer.CreateNetEqNetworkStatsGraph( |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 413 | neteq_stats, |
| 414 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 415 | return stats.expand_rate / 16384.f; |
| 416 | }, |
| 417 | "Expand rate", collection->AppendNewPlot()); |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 418 | analyzer.CreateNetEqNetworkStatsGraph( |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 419 | neteq_stats, |
| 420 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 421 | return stats.speech_expand_rate / 16384.f; |
| 422 | }, |
| 423 | "Speech expand rate", collection->AppendNewPlot()); |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 424 | analyzer.CreateNetEqNetworkStatsGraph( |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 425 | neteq_stats, |
| 426 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 427 | return stats.accelerate_rate / 16384.f; |
| 428 | }, |
| 429 | "Accelerate rate", collection->AppendNewPlot()); |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 430 | analyzer.CreateNetEqNetworkStatsGraph( |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 431 | neteq_stats, |
| 432 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 433 | return stats.packet_loss_rate / 16384.f; |
| 434 | }, |
| 435 | "Packet loss rate", collection->AppendNewPlot()); |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 436 | analyzer.CreateNetEqLifetimeStatsGraph( |
| 437 | neteq_stats, |
| 438 | [](const webrtc::NetEqLifetimeStatistics& stats) { |
| 439 | return static_cast<float>(stats.concealment_events); |
| 440 | }, |
| 441 | "Concealment events", collection->AppendNewPlot()); |
henrik.lundin | 3c938fc | 2017-06-14 06:09:58 -0700 | [diff] [blame] | 442 | } |
| 443 | |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 444 | if (FLAG_plot_ice_candidate_pair_config) { |
| 445 | analyzer.CreateIceCandidatePairConfigGraph(collection->AppendNewPlot()); |
| 446 | } |
| 447 | if (FLAG_plot_ice_connectivity_check) { |
| 448 | analyzer.CreateIceConnectivityCheckGraph(collection->AppendNewPlot()); |
| 449 | } |
| 450 | |
terelius | dc35dcd | 2016-08-01 12:03:27 -0700 | [diff] [blame] | 451 | collection->Draw(); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 452 | |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 453 | if (FLAG_print_triage_alerts) { |
Bjorn Terelius | 2eb3188 | 2017-11-30 15:15:25 +0100 | [diff] [blame] | 454 | analyzer.CreateTriageNotifications(); |
| 455 | analyzer.PrintNotifications(stderr); |
| 456 | } |
| 457 | |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 458 | return 0; |
| 459 | } |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 460 | |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 461 | void SetAllPlotFlags(bool setting) { |
| 462 | FLAG_plot_incoming_packet_sizes = setting; |
| 463 | FLAG_plot_outgoing_packet_sizes = setting; |
| 464 | FLAG_plot_incoming_packet_count = setting; |
| 465 | FLAG_plot_outgoing_packet_count = setting; |
| 466 | FLAG_plot_audio_playout = setting; |
| 467 | FLAG_plot_audio_level = setting; |
| 468 | FLAG_plot_incoming_sequence_number_delta = setting; |
| 469 | FLAG_plot_incoming_delay_delta = setting; |
| 470 | FLAG_plot_incoming_delay = setting; |
| 471 | FLAG_plot_incoming_loss_rate = setting; |
| 472 | FLAG_plot_incoming_bitrate = setting; |
| 473 | FLAG_plot_outgoing_bitrate = setting; |
| 474 | FLAG_plot_incoming_stream_bitrate = setting; |
| 475 | FLAG_plot_outgoing_stream_bitrate = setting; |
Bjorn Terelius | 28db266 | 2017-10-04 14:22:43 +0200 | [diff] [blame] | 476 | FLAG_plot_simulated_receiveside_bwe = setting; |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 477 | FLAG_plot_simulated_sendside_bwe = setting; |
| 478 | FLAG_plot_network_delay_feedback = setting; |
| 479 | FLAG_plot_fraction_loss_feedback = setting; |
| 480 | FLAG_plot_timestamps = setting; |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 481 | FLAG_plot_rtcp_details = setting; |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 482 | FLAG_plot_audio_encoder_bitrate_bps = setting; |
| 483 | FLAG_plot_audio_encoder_frame_length_ms = setting; |
| 484 | FLAG_plot_audio_encoder_packet_loss = setting; |
| 485 | FLAG_plot_audio_encoder_fec = setting; |
| 486 | FLAG_plot_audio_encoder_dtx = setting; |
| 487 | FLAG_plot_audio_encoder_num_channels = setting; |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 488 | FLAG_plot_neteq_stats = setting; |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 489 | FLAG_plot_ice_candidate_pair_config = setting; |
| 490 | FLAG_plot_ice_connectivity_check = setting; |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 491 | } |