blob: 2a52d064bb5ad8a3ad9ab3ab1ad1a67c93a4a169 [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"
Mirko Bonadei17f48782018-09-28 08:51:10 +020019#include "system_wrappers/include/field_trial.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
Mirko Bonadeic538fc72018-10-19 15:04:07 +000023DEFINE_string(plot_profile,
24 "default",
25 "A profile that selects a certain subset of the plots. Currently "
26 "defined profiles are \"all\", \"none\", \"sendside_bwe\","
27 "\"receiveside_bwe\" and \"default\"");
terelius2ee076d2017-08-15 02:04:02 -070028
Mirko Bonadeic538fc72018-10-19 15:04:07 +000029DEFINE_bool(plot_incoming_packet_sizes,
30 false,
31 "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.");
41DEFINE_bool(plot_audio_playout,
42 false,
43 "Plot bar graph showing the time between each audio playout.");
44DEFINE_bool(plot_audio_level,
45 false,
46 "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.");
51DEFINE_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.");
Mirko Bonadeic538fc72018-10-19 15:04:07 +000055DEFINE_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.");
77DEFINE_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.");
81DEFINE_bool(plot_simulated_sendside_bwe,
82 false,
83 "Run the send-side bandwidth estimator with the outgoing rtp and "
84 "incoming rtcp and plot the resulting estimate.");
85DEFINE_bool(plot_network_delay_feedback,
86 true,
87 "Compute network delay based on sent packets and the received "
88 "transport feedback.");
89DEFINE_bool(plot_fraction_loss_feedback,
90 true,
91 "Plot packet loss in percent for outgoing packets (as perceived by "
92 "the send-side bandwidth estimator).");
93DEFINE_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).");
98DEFINE_bool(plot_timestamps,
99 false,
100 "Plot the rtp timestamps of all rtp and rtcp packets over time.");
101DEFINE_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.");
107DEFINE_bool(plot_audio_encoder_bitrate_bps,
108 false,
109 "Plot the audio encoder target bitrate.");
110DEFINE_bool(plot_audio_encoder_frame_length_ms,
111 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.");
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000117DEFINE_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,
120 false,
121 "Plot the audio encoder number of channels.");
122DEFINE_bool(plot_neteq_stats, false, "Plot the NetEq statistics.");
123DEFINE_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
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000130DEFINE_string(
stefan985d2802016-11-15 06:54:09 -0800131 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 \"/\"");
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000137DEFINE_string(wav_filename,
138 "",
139 "Path to wav file used for simulation of jitter buffer");
140DEFINE_bool(help, false, "prints this message");
terelius54ce6802016-07-13 06:44:41 -0700141
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000142DEFINE_bool(show_detector_state,
143 false,
144 "Show the state of the delay based BWE detector on the total "
145 "bitrate graph");
terelius2ee076d2017-08-15 02:04:02 -0700146
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000147DEFINE_bool(show_alr_state,
148 false,
149 "Show the state ALR state on the total bitrate graph");
Ilya Nikolaevskiya4259f62017-12-05 13:19:45 +0100150
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000151DEFINE_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.");
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200156
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000157DEFINE_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
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000161DEFINE_bool(normalize_time,
162 true,
163 "Normalize the log timestamps so that the call starts at time 0.");
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200164
Mirko Bonadeic538fc72018-10-19 15:04:07 +0000165DEFINE_bool(protobuf_output,
166 false,
167 "Output charts as protobuf instead of python code.");
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200168
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
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100221 webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials);
222 // InitFieldTrialsFromString stores the char*, so the char array must outlive
223 // the application.
224 webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
stefan985d2802016-11-15 06:54:09 -0800225
terelius54ce6802016-07-13 06:44:41 -0700226 std::string filename = argv[1];
227
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200228 webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions header_extensions =
229 webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions::kDontParse;
230 if (FLAG_parse_unconfigured_header_extensions) {
231 header_extensions = webrtc::ParsedRtcEventLogNew::
232 UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig;
233 }
234 webrtc::ParsedRtcEventLogNew parsed_log(header_extensions);
terelius54ce6802016-07-13 06:44:41 -0700235
236 if (!parsed_log.ParseFile(filename)) {
237 std::cerr << "Could not parse the entire log file." << std::endl;
238 std::cerr << "Proceeding to analyze the first "
239 << parsed_log.GetNumberOfEvents() << " events in the file."
240 << std::endl;
241 }
242
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200243 webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time);
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200244 std::unique_ptr<webrtc::PlotCollection> collection;
245 if (FLAG_protobuf_output) {
246 collection.reset(new webrtc::ProtobufPlotCollection());
247 } else {
248 collection.reset(new webrtc::PythonPlotCollection());
249 }
terelius54ce6802016-07-13 06:44:41 -0700250
terelius2ee076d2017-08-15 02:04:02 -0700251 if (FLAG_plot_incoming_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200252 analyzer.CreatePacketGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700253 collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700254 }
terelius2ee076d2017-08-15 02:04:02 -0700255 if (FLAG_plot_outgoing_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200256 analyzer.CreatePacketGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700257 collection->AppendNewPlot());
258 }
259 if (FLAG_plot_incoming_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200260 analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket,
261 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700262 }
263 if (FLAG_plot_outgoing_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200264 analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket,
265 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700266 }
267 if (FLAG_plot_audio_playout) {
tereliusdc35dcd2016-08-01 12:03:27 -0700268 analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700269 }
terelius2ee076d2017-08-15 02:04:02 -0700270 if (FLAG_plot_audio_level) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200271 analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket,
272 collection->AppendNewPlot());
273 analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket,
274 collection->AppendNewPlot());
ivocaac9d6f2016-09-22 07:01:47 -0700275 }
terelius2ee076d2017-08-15 02:04:02 -0700276 if (FLAG_plot_incoming_sequence_number_delta) {
277 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700278 }
terelius2ee076d2017-08-15 02:04:02 -0700279 if (FLAG_plot_incoming_delay_delta) {
280 analyzer.CreateIncomingDelayDeltaGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700281 }
terelius2ee076d2017-08-15 02:04:02 -0700282 if (FLAG_plot_incoming_delay) {
283 analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700284 }
terelius2ee076d2017-08-15 02:04:02 -0700285 if (FLAG_plot_incoming_loss_rate) {
Stefan Holmer99f8e082016-09-09 13:37:50 +0200286 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
tereliusf736d232016-08-04 10:00:11 -0700287 }
terelius2ee076d2017-08-15 02:04:02 -0700288 if (FLAG_plot_incoming_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200289 analyzer.CreateTotalIncomingBitrateGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700290 }
terelius2ee076d2017-08-15 02:04:02 -0700291 if (FLAG_plot_outgoing_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200292 analyzer.CreateTotalOutgoingBitrateGraph(collection->AppendNewPlot(),
293 FLAG_show_detector_state,
294 FLAG_show_alr_state);
terelius54ce6802016-07-13 06:44:41 -0700295 }
terelius2ee076d2017-08-15 02:04:02 -0700296 if (FLAG_plot_incoming_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200297 analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700298 collection->AppendNewPlot());
299 }
300 if (FLAG_plot_outgoing_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200301 analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700302 collection->AppendNewPlot());
303 }
Bjorn Terelius28db2662017-10-04 14:22:43 +0200304 if (FLAG_plot_simulated_receiveside_bwe) {
305 analyzer.CreateReceiveSideBweSimulationGraph(collection->AppendNewPlot());
306 }
terelius2ee076d2017-08-15 02:04:02 -0700307 if (FLAG_plot_simulated_sendside_bwe) {
Bjorn Terelius28db2662017-10-04 14:22:43 +0200308 analyzer.CreateSendSideBweSimulationGraph(collection->AppendNewPlot());
Stefan Holmer13181032016-07-29 14:48:54 +0200309 }
terelius2ee076d2017-08-15 02:04:02 -0700310 if (FLAG_plot_network_delay_feedback) {
tereliuse34c19c2016-08-15 08:47:14 -0700311 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
stefanc3de0332016-08-02 07:22:17 -0700312 }
terelius2ee076d2017-08-15 02:04:02 -0700313 if (FLAG_plot_fraction_loss_feedback) {
314 analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
315 }
316 if (FLAG_plot_timestamps) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200317 analyzer.CreateTimestampGraph(webrtc::kIncomingPacket,
318 collection->AppendNewPlot());
319 analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket,
320 collection->AppendNewPlot());
stefane372d3c2017-02-02 08:04:18 -0800321 }
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200322 if (FLAG_plot_rtcp_details) {
323 auto GetFractionLost = [](const webrtc::rtcp::ReportBlock& block) -> float {
324 return static_cast<double>(block.fraction_lost()) / 256 * 100;
325 };
326 analyzer.CreateSenderAndReceiverReportPlot(
327 webrtc::kIncomingPacket, GetFractionLost,
328 "Fraction lost (incoming RTCP)", "Loss rate (percent)",
329 collection->AppendNewPlot());
330 analyzer.CreateSenderAndReceiverReportPlot(
331 webrtc::kOutgoingPacket, GetFractionLost,
332 "Fraction lost (outgoing RTCP)", "Loss rate (percent)",
333 collection->AppendNewPlot());
334
335 auto GetCumulativeLost =
336 [](const webrtc::rtcp::ReportBlock& block) -> float {
337 return block.cumulative_lost_signed();
338 };
339 analyzer.CreateSenderAndReceiverReportPlot(
340 webrtc::kIncomingPacket, GetCumulativeLost,
341 "Cumulative lost packets (incoming RTCP)", "Packets",
342 collection->AppendNewPlot());
343 analyzer.CreateSenderAndReceiverReportPlot(
344 webrtc::kOutgoingPacket, GetCumulativeLost,
345 "Cumulative lost packets (outgoing RTCP)", "Packets",
346 collection->AppendNewPlot());
347
348 auto GetHighestSeqNumber =
349 [](const webrtc::rtcp::ReportBlock& block) -> float {
350 return block.extended_high_seq_num();
351 };
352 analyzer.CreateSenderAndReceiverReportPlot(
353 webrtc::kIncomingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200354 "Highest sequence number (incoming RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200355 collection->AppendNewPlot());
356 analyzer.CreateSenderAndReceiverReportPlot(
357 webrtc::kOutgoingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200358 "Highest sequence number (outgoing RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200359 collection->AppendNewPlot());
360
361 auto DelaySinceLastSr =
362 [](const webrtc::rtcp::ReportBlock& block) -> float {
363 return static_cast<double>(block.delay_since_last_sr()) / 65536;
364 };
365 analyzer.CreateSenderAndReceiverReportPlot(
366 webrtc::kIncomingPacket, DelaySinceLastSr,
367 "Delay since last received sender report (incoming RTCP)", "Time (s)",
368 collection->AppendNewPlot());
369 analyzer.CreateSenderAndReceiverReportPlot(
370 webrtc::kOutgoingPacket, DelaySinceLastSr,
371 "Delay since last received sender report (outgoing RTCP)", "Time (s)",
372 collection->AppendNewPlot());
373 }
374
Bjorn Terelius0295a962017-10-25 17:42:41 +0200375 if (FLAG_plot_pacer_delay) {
376 analyzer.CreatePacerDelayGraph(collection->AppendNewPlot());
377 }
terelius2ee076d2017-08-15 02:04:02 -0700378 if (FLAG_plot_audio_encoder_bitrate_bps) {
michaelt6e5b2192017-02-22 07:33:27 -0800379 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
380 }
terelius2ee076d2017-08-15 02:04:02 -0700381 if (FLAG_plot_audio_encoder_frame_length_ms) {
michaelt6e5b2192017-02-22 07:33:27 -0800382 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
383 }
terelius2ee076d2017-08-15 02:04:02 -0700384 if (FLAG_plot_audio_encoder_packet_loss) {
385 analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot());
michaelt6e5b2192017-02-22 07:33:27 -0800386 }
terelius2ee076d2017-08-15 02:04:02 -0700387 if (FLAG_plot_audio_encoder_fec) {
michaelt6e5b2192017-02-22 07:33:27 -0800388 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
389 }
terelius2ee076d2017-08-15 02:04:02 -0700390 if (FLAG_plot_audio_encoder_dtx) {
michaelt6e5b2192017-02-22 07:33:27 -0800391 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
392 }
terelius2ee076d2017-08-15 02:04:02 -0700393 if (FLAG_plot_audio_encoder_num_channels) {
michaelt6e5b2192017-02-22 07:33:27 -0800394 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
395 }
Minyue Li27e2b7d2018-05-07 15:20:24 +0200396 if (FLAG_plot_neteq_stats) {
owb7fbeb0b2017-08-16 02:48:33 -0700397 std::string wav_path;
398 if (FLAG_wav_filename[0] != '\0') {
399 wav_path = FLAG_wav_filename;
400 } else {
401 wav_path = webrtc::test::ResourcePath(
402 "audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav");
403 }
Minyue Lic6ff7572018-05-04 09:46:44 +0200404 auto neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
Minyue Li01d2a672018-06-21 21:17:19 +0200405 for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it =
406 neteq_stats.cbegin();
407 it != neteq_stats.cend(); ++it) {
408 analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(),
Minyue Li45fc6df2018-06-21 11:47:14 +0200409 collection->AppendNewPlot());
410 }
Minyue Lic9ac93f2018-06-26 13:01:32 +0200411 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200412 neteq_stats,
413 [](const webrtc::NetEqNetworkStatistics& stats) {
414 return stats.expand_rate / 16384.f;
415 },
416 "Expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200417 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200418 neteq_stats,
419 [](const webrtc::NetEqNetworkStatistics& stats) {
420 return stats.speech_expand_rate / 16384.f;
421 },
422 "Speech expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200423 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200424 neteq_stats,
425 [](const webrtc::NetEqNetworkStatistics& stats) {
426 return stats.accelerate_rate / 16384.f;
427 },
428 "Accelerate rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200429 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200430 neteq_stats,
431 [](const webrtc::NetEqNetworkStatistics& stats) {
432 return stats.packet_loss_rate / 16384.f;
433 },
434 "Packet loss rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200435 analyzer.CreateNetEqLifetimeStatsGraph(
436 neteq_stats,
437 [](const webrtc::NetEqLifetimeStatistics& stats) {
438 return static_cast<float>(stats.concealment_events);
439 },
440 "Concealment events", collection->AppendNewPlot());
henrik.lundin3c938fc2017-06-14 06:09:58 -0700441 }
442
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800443 if (FLAG_plot_ice_candidate_pair_config) {
444 analyzer.CreateIceCandidatePairConfigGraph(collection->AppendNewPlot());
445 }
446 if (FLAG_plot_ice_connectivity_check) {
447 analyzer.CreateIceConnectivityCheckGraph(collection->AppendNewPlot());
448 }
449
tereliusdc35dcd2016-08-01 12:03:27 -0700450 collection->Draw();
terelius54ce6802016-07-13 06:44:41 -0700451
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200452 if (FLAG_print_triage_alerts) {
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100453 analyzer.CreateTriageNotifications();
454 analyzer.PrintNotifications(stderr);
455 }
456
terelius54ce6802016-07-13 06:44:41 -0700457 return 0;
458}
terelius2ee076d2017-08-15 02:04:02 -0700459
terelius2ee076d2017-08-15 02:04:02 -0700460void SetAllPlotFlags(bool setting) {
461 FLAG_plot_incoming_packet_sizes = setting;
462 FLAG_plot_outgoing_packet_sizes = setting;
463 FLAG_plot_incoming_packet_count = setting;
464 FLAG_plot_outgoing_packet_count = setting;
465 FLAG_plot_audio_playout = setting;
466 FLAG_plot_audio_level = setting;
467 FLAG_plot_incoming_sequence_number_delta = setting;
468 FLAG_plot_incoming_delay_delta = setting;
469 FLAG_plot_incoming_delay = setting;
470 FLAG_plot_incoming_loss_rate = setting;
471 FLAG_plot_incoming_bitrate = setting;
472 FLAG_plot_outgoing_bitrate = setting;
473 FLAG_plot_incoming_stream_bitrate = setting;
474 FLAG_plot_outgoing_stream_bitrate = setting;
Bjorn Terelius28db2662017-10-04 14:22:43 +0200475 FLAG_plot_simulated_receiveside_bwe = setting;
terelius2ee076d2017-08-15 02:04:02 -0700476 FLAG_plot_simulated_sendside_bwe = setting;
477 FLAG_plot_network_delay_feedback = setting;
478 FLAG_plot_fraction_loss_feedback = setting;
479 FLAG_plot_timestamps = setting;
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200480 FLAG_plot_rtcp_details = setting;
terelius2ee076d2017-08-15 02:04:02 -0700481 FLAG_plot_audio_encoder_bitrate_bps = setting;
482 FLAG_plot_audio_encoder_frame_length_ms = setting;
483 FLAG_plot_audio_encoder_packet_loss = setting;
484 FLAG_plot_audio_encoder_fec = setting;
485 FLAG_plot_audio_encoder_dtx = setting;
486 FLAG_plot_audio_encoder_num_channels = setting;
Minyue Li27e2b7d2018-05-07 15:20:24 +0200487 FLAG_plot_neteq_stats = setting;
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800488 FLAG_plot_ice_candidate_pair_config = setting;
489 FLAG_plot_ice_connectivity_check = setting;
terelius2ee076d2017-08-15 02:04:02 -0700490}