blob: 4e5534e1dc78fd3de340d29f02c7f64a695b91c3 [file] [log] [blame]
terelius54ce6802016-07-13 06:44:41 -07001/*
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 Tereliusc4ca1d32018-04-27 14:33:34 +020013#include "logging/rtc_event_log/rtc_event_log_parser_new.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#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 Tereliusef73f592018-09-10 20:11:49 +020017#include "rtc_tools/event_log_visualizer/plot_protobuf.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "rtc_tools/event_log_visualizer/plot_python.h"
Bjorn Tereliusedab3012018-01-31 17:23:40 +010019#include "system_wrappers/include/field_trial_default.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020020#include "test/field_trial.h"
21#include "test/testsupport/fileutils.h"
terelius54ce6802016-07-13 06:44:41 -070022
terelius2ee076d2017-08-15 02:04:02 -070023DEFINE_string(plot_profile,
24 "default",
25 "A profile that selects a certain subset of the plots. Currently "
Bjorn Terelius1edfff92017-10-11 13:15:19 +020026 "defined profiles are \"all\", \"none\", \"sendside_bwe\","
27 "\"receiveside_bwe\" and \"default\"");
terelius2ee076d2017-08-15 02:04:02 -070028
29DEFINE_bool(plot_incoming_packet_sizes,
terelius54ce6802016-07-13 06:44:41 -070030 false,
terelius2ee076d2017-08-15 02:04:02 -070031 "Plot bar graph showing the size of each incoming packet.");
32DEFINE_bool(plot_outgoing_packet_sizes,
33 false,
34 "Plot bar graph showing the size of each outgoing packet.");
35DEFINE_bool(plot_incoming_packet_count,
36 false,
37 "Plot the accumulated number of packets for each incoming stream.");
38DEFINE_bool(plot_outgoing_packet_count,
39 false,
40 "Plot the accumulated number of packets for each outgoing stream.");
terelius54ce6802016-07-13 06:44:41 -070041DEFINE_bool(plot_audio_playout,
42 false,
43 "Plot bar graph showing the time between each audio playout.");
ivocaac9d6f2016-09-22 07:01:47 -070044DEFINE_bool(plot_audio_level,
45 false,
terelius2ee076d2017-08-15 02:04:02 -070046 "Plot line graph showing the audio level of incoming audio.");
47DEFINE_bool(plot_incoming_sequence_number_delta,
48 false,
49 "Plot the sequence number difference between consecutive incoming "
50 "packets.");
terelius54ce6802016-07-13 06:44:41 -070051DEFINE_bool(
terelius2ee076d2017-08-15 02:04:02 -070052 plot_incoming_delay_delta,
terelius54ce6802016-07-13 06:44:41 -070053 false,
54 "Plot the difference in 1-way path delay between consecutive packets.");
terelius2ee076d2017-08-15 02:04:02 -070055DEFINE_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.");
59DEFINE_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.");
65DEFINE_bool(plot_incoming_bitrate,
66 true,
67 "Plot the total bitrate used by all incoming streams.");
68DEFINE_bool(plot_outgoing_bitrate,
69 true,
70 "Plot the total bitrate used by all outgoing streams.");
71DEFINE_bool(plot_incoming_stream_bitrate,
72 true,
73 "Plot the bitrate used by each incoming stream.");
74DEFINE_bool(plot_outgoing_stream_bitrate,
75 true,
76 "Plot the bitrate used by each outgoing stream.");
Bjorn Terelius28db2662017-10-04 14:22:43 +020077DEFINE_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.");
terelius2ee076d2017-08-15 02:04:02 -070081DEFINE_bool(plot_simulated_sendside_bwe,
terelius54ce6802016-07-13 06:44:41 -070082 false,
terelius2ee076d2017-08-15 02:04:02 -070083 "Run the send-side bandwidth estimator with the outgoing rtp and "
84 "incoming rtcp and plot the resulting estimate.");
stefanc3de0332016-08-02 07:22:17 -070085DEFINE_bool(plot_network_delay_feedback,
terelius2ee076d2017-08-15 02:04:02 -070086 true,
stefanc3de0332016-08-02 07:22:17 -070087 "Compute network delay based on sent packets and the received "
88 "transport feedback.");
terelius2ee076d2017-08-15 02:04:02 -070089DEFINE_bool(plot_fraction_loss_feedback,
90 true,
tereliusf736d232016-08-04 10:00:11 -070091 "Plot packet loss in percent for outgoing packets (as perceived by "
92 "the send-side bandwidth estimator).");
Bjorn Terelius0295a962017-10-25 17:42:41 +020093DEFINE_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).");
stefane372d3c2017-02-02 08:04:18 -080098DEFINE_bool(plot_timestamps,
99 false,
100 "Plot the rtp timestamps of all rtp and rtcp packets over time.");
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200101DEFINE_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.");
terelius2ee076d2017-08-15 02:04:02 -0700107DEFINE_bool(plot_audio_encoder_bitrate_bps,
michaelt6e5b2192017-02-22 07:33:27 -0800108 false,
109 "Plot the audio encoder target bitrate.");
terelius2ee076d2017-08-15 02:04:02 -0700110DEFINE_bool(plot_audio_encoder_frame_length_ms,
michaelt6e5b2192017-02-22 07:33:27 -0800111 false,
112 "Plot the audio encoder frame length.");
113DEFINE_bool(
terelius2ee076d2017-08-15 02:04:02 -0700114 plot_audio_encoder_packet_loss,
michaelt6e5b2192017-02-22 07:33:27 -0800115 false,
terelius2ee076d2017-08-15 02:04:02 -0700116 "Plot the uplink packet loss fraction which is sent to the audio encoder.");
117DEFINE_bool(plot_audio_encoder_fec, false, "Plot the audio encoder FEC.");
118DEFINE_bool(plot_audio_encoder_dtx, false, "Plot the audio encoder DTX.");
119DEFINE_bool(plot_audio_encoder_num_channels,
michaelt6e5b2192017-02-22 07:33:27 -0800120 false,
121 "Plot the audio encoder number of channels.");
Minyue Li27e2b7d2018-05-07 15:20:24 +0200122DEFINE_bool(plot_neteq_stats, false, "Plot the NetEq statistics.");
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800123DEFINE_bool(plot_ice_candidate_pair_config,
124 false,
125 "Plot the ICE candidate pair config events.");
126DEFINE_bool(plot_ice_connectivity_check,
127 false,
128 "Plot the ICE candidate pair connectivity checks.");
Bjorn Terelius1edfff92017-10-11 13:15:19 +0200129
stefan985d2802016-11-15 06:54:09 -0800130DEFINE_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 \"/\"");
owb7fbeb0b2017-08-16 02:48:33 -0700137DEFINE_string(wav_filename,
138 "",
139 "Path to wav file used for simulation of jitter buffer");
kjellander4fa5be42017-05-16 00:01:23 -0700140DEFINE_bool(help, false, "prints this message");
terelius54ce6802016-07-13 06:44:41 -0700141
terelius2ee076d2017-08-15 02:04:02 -0700142DEFINE_bool(show_detector_state,
143 false,
144 "Show the state of the delay based BWE detector on the total "
145 "bitrate graph");
146
Ilya Nikolaevskiya4259f62017-12-05 13:19:45 +0100147DEFINE_bool(show_alr_state,
148 false,
149 "Show the state ALR state on the total bitrate graph");
150
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200151DEFINE_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
157DEFINE_bool(print_triage_alerts,
158 false,
159 "Print triage alerts, i.e. a list of potential problems.");
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100160
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200161DEFINE_bool(normalize_time,
162 true,
163 "Normalize the log timestamps so that the call starts at time 0.");
164
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200165DEFINE_bool(protobuf_output,
166 false,
167 "Output charts as protobuf instead of python code.");
168
terelius2ee076d2017-08-15 02:04:02 -0700169void SetAllPlotFlags(bool setting);
170
terelius54ce6802016-07-13 06:44:41 -0700171int 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";
terelius2ee076d2017-08-15 02:04:02 -0700178
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 Terelius1edfff92017-10-11 13:15:19 +0200186 } 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;
terelius2ee076d2017-08-15 02:04:02 -0700203 } 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.
kjellander4fa5be42017-05-16 00:01:23 -0700211 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
terelius2ee076d2017-08-15 02:04:02 -0700212
tereliusc4a5c142017-07-20 08:05:09 -0700213 if (argc != 2 || FLAG_help) {
kjellander4fa5be42017-05-16 00:01:23 -0700214 // Print usage information.
215 std::cout << usage;
tereliusc4a5c142017-07-20 08:05:09 -0700216 if (FLAG_help)
217 rtc::FlagList::Print(nullptr, false);
kjellander4fa5be42017-05-16 00:01:23 -0700218 return 0;
219 }
220
henrik.lundin3c938fc2017-06-14 06:09:58 -0700221 webrtc::test::SetExecutablePath(argv[0]);
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100222 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);
stefan985d2802016-11-15 06:54:09 -0800226
terelius54ce6802016-07-13 06:44:41 -0700227 std::string filename = argv[1];
228
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200229 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);
terelius54ce6802016-07-13 06:44:41 -0700236
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 Holmer1d4a2272018-05-24 13:48:09 +0200244 webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time);
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200245 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 }
terelius54ce6802016-07-13 06:44:41 -0700251
terelius2ee076d2017-08-15 02:04:02 -0700252 if (FLAG_plot_incoming_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200253 analyzer.CreatePacketGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700254 collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700255 }
terelius2ee076d2017-08-15 02:04:02 -0700256 if (FLAG_plot_outgoing_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200257 analyzer.CreatePacketGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700258 collection->AppendNewPlot());
259 }
260 if (FLAG_plot_incoming_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200261 analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket,
262 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700263 }
264 if (FLAG_plot_outgoing_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200265 analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket,
266 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700267 }
268 if (FLAG_plot_audio_playout) {
tereliusdc35dcd2016-08-01 12:03:27 -0700269 analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700270 }
terelius2ee076d2017-08-15 02:04:02 -0700271 if (FLAG_plot_audio_level) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200272 analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket,
273 collection->AppendNewPlot());
274 analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket,
275 collection->AppendNewPlot());
ivocaac9d6f2016-09-22 07:01:47 -0700276 }
terelius2ee076d2017-08-15 02:04:02 -0700277 if (FLAG_plot_incoming_sequence_number_delta) {
278 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700279 }
terelius2ee076d2017-08-15 02:04:02 -0700280 if (FLAG_plot_incoming_delay_delta) {
281 analyzer.CreateIncomingDelayDeltaGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700282 }
terelius2ee076d2017-08-15 02:04:02 -0700283 if (FLAG_plot_incoming_delay) {
284 analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700285 }
terelius2ee076d2017-08-15 02:04:02 -0700286 if (FLAG_plot_incoming_loss_rate) {
Stefan Holmer99f8e082016-09-09 13:37:50 +0200287 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
tereliusf736d232016-08-04 10:00:11 -0700288 }
terelius2ee076d2017-08-15 02:04:02 -0700289 if (FLAG_plot_incoming_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200290 analyzer.CreateTotalIncomingBitrateGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700291 }
terelius2ee076d2017-08-15 02:04:02 -0700292 if (FLAG_plot_outgoing_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200293 analyzer.CreateTotalOutgoingBitrateGraph(collection->AppendNewPlot(),
294 FLAG_show_detector_state,
295 FLAG_show_alr_state);
terelius54ce6802016-07-13 06:44:41 -0700296 }
terelius2ee076d2017-08-15 02:04:02 -0700297 if (FLAG_plot_incoming_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200298 analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700299 collection->AppendNewPlot());
300 }
301 if (FLAG_plot_outgoing_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200302 analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700303 collection->AppendNewPlot());
304 }
Bjorn Terelius28db2662017-10-04 14:22:43 +0200305 if (FLAG_plot_simulated_receiveside_bwe) {
306 analyzer.CreateReceiveSideBweSimulationGraph(collection->AppendNewPlot());
307 }
terelius2ee076d2017-08-15 02:04:02 -0700308 if (FLAG_plot_simulated_sendside_bwe) {
Bjorn Terelius28db2662017-10-04 14:22:43 +0200309 analyzer.CreateSendSideBweSimulationGraph(collection->AppendNewPlot());
Stefan Holmer13181032016-07-29 14:48:54 +0200310 }
terelius2ee076d2017-08-15 02:04:02 -0700311 if (FLAG_plot_network_delay_feedback) {
tereliuse34c19c2016-08-15 08:47:14 -0700312 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
stefanc3de0332016-08-02 07:22:17 -0700313 }
terelius2ee076d2017-08-15 02:04:02 -0700314 if (FLAG_plot_fraction_loss_feedback) {
315 analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
316 }
317 if (FLAG_plot_timestamps) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200318 analyzer.CreateTimestampGraph(webrtc::kIncomingPacket,
319 collection->AppendNewPlot());
320 analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket,
321 collection->AppendNewPlot());
stefane372d3c2017-02-02 08:04:18 -0800322 }
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200323 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 Tereliusef73f592018-09-10 20:11:49 +0200355 "Highest sequence number (incoming RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200356 collection->AppendNewPlot());
357 analyzer.CreateSenderAndReceiverReportPlot(
358 webrtc::kOutgoingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200359 "Highest sequence number (outgoing RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200360 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 Terelius0295a962017-10-25 17:42:41 +0200376 if (FLAG_plot_pacer_delay) {
377 analyzer.CreatePacerDelayGraph(collection->AppendNewPlot());
378 }
terelius2ee076d2017-08-15 02:04:02 -0700379 if (FLAG_plot_audio_encoder_bitrate_bps) {
michaelt6e5b2192017-02-22 07:33:27 -0800380 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
381 }
terelius2ee076d2017-08-15 02:04:02 -0700382 if (FLAG_plot_audio_encoder_frame_length_ms) {
michaelt6e5b2192017-02-22 07:33:27 -0800383 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
384 }
terelius2ee076d2017-08-15 02:04:02 -0700385 if (FLAG_plot_audio_encoder_packet_loss) {
386 analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot());
michaelt6e5b2192017-02-22 07:33:27 -0800387 }
terelius2ee076d2017-08-15 02:04:02 -0700388 if (FLAG_plot_audio_encoder_fec) {
michaelt6e5b2192017-02-22 07:33:27 -0800389 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
390 }
terelius2ee076d2017-08-15 02:04:02 -0700391 if (FLAG_plot_audio_encoder_dtx) {
michaelt6e5b2192017-02-22 07:33:27 -0800392 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
393 }
terelius2ee076d2017-08-15 02:04:02 -0700394 if (FLAG_plot_audio_encoder_num_channels) {
michaelt6e5b2192017-02-22 07:33:27 -0800395 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
396 }
Minyue Li27e2b7d2018-05-07 15:20:24 +0200397 if (FLAG_plot_neteq_stats) {
owb7fbeb0b2017-08-16 02:48:33 -0700398 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 Lic6ff7572018-05-04 09:46:44 +0200405 auto neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
Minyue Li01d2a672018-06-21 21:17:19 +0200406 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 Li45fc6df2018-06-21 11:47:14 +0200410 collection->AppendNewPlot());
411 }
Minyue Lic9ac93f2018-06-26 13:01:32 +0200412 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200413 neteq_stats,
414 [](const webrtc::NetEqNetworkStatistics& stats) {
415 return stats.expand_rate / 16384.f;
416 },
417 "Expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200418 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200419 neteq_stats,
420 [](const webrtc::NetEqNetworkStatistics& stats) {
421 return stats.speech_expand_rate / 16384.f;
422 },
423 "Speech expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200424 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200425 neteq_stats,
426 [](const webrtc::NetEqNetworkStatistics& stats) {
427 return stats.accelerate_rate / 16384.f;
428 },
429 "Accelerate rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200430 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200431 neteq_stats,
432 [](const webrtc::NetEqNetworkStatistics& stats) {
433 return stats.packet_loss_rate / 16384.f;
434 },
435 "Packet loss rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200436 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.lundin3c938fc2017-06-14 06:09:58 -0700442 }
443
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800444 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
tereliusdc35dcd2016-08-01 12:03:27 -0700451 collection->Draw();
terelius54ce6802016-07-13 06:44:41 -0700452
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200453 if (FLAG_print_triage_alerts) {
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100454 analyzer.CreateTriageNotifications();
455 analyzer.PrintNotifications(stderr);
456 }
457
terelius54ce6802016-07-13 06:44:41 -0700458 return 0;
459}
terelius2ee076d2017-08-15 02:04:02 -0700460
terelius2ee076d2017-08-15 02:04:02 -0700461void 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 Terelius28db2662017-10-04 14:22:43 +0200476 FLAG_plot_simulated_receiveside_bwe = setting;
terelius2ee076d2017-08-15 02:04:02 -0700477 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 Tereliusb1222c22018-07-24 13:45:31 +0200481 FLAG_plot_rtcp_details = setting;
terelius2ee076d2017-08-15 02:04:02 -0700482 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 Li27e2b7d2018-05-07 15:20:24 +0200488 FLAG_plot_neteq_stats = setting;
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800489 FLAG_plot_ice_candidate_pair_config = setting;
490 FLAG_plot_ice_connectivity_check = setting;
terelius2ee076d2017-08-15 02:04:02 -0700491}