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