blob: ad90cfbacb565f845363e625d4296d8691ae359d [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 Bonadei5ccdc132018-10-18 11:35:32 +020023WEBRTC_DEFINE_string(
24 plot_profile,
25 "default",
26 "A profile that selects a certain subset of the plots. Currently "
27 "defined profiles are \"all\", \"none\", \"sendside_bwe\","
28 "\"receiveside_bwe\" and \"default\"");
terelius2ee076d2017-08-15 02:04:02 -070029
Mirko Bonadei5ccdc132018-10-18 11:35:32 +020030WEBRTC_DEFINE_bool(plot_incoming_packet_sizes,
31 false,
32 "Plot bar graph showing the size of each incoming packet.");
33WEBRTC_DEFINE_bool(plot_outgoing_packet_sizes,
34 false,
35 "Plot bar graph showing the size of each outgoing packet.");
36WEBRTC_DEFINE_bool(
37 plot_incoming_packet_count,
38 false,
39 "Plot the accumulated number of packets for each incoming stream.");
40WEBRTC_DEFINE_bool(
41 plot_outgoing_packet_count,
42 false,
43 "Plot the accumulated number of packets for each outgoing stream.");
44WEBRTC_DEFINE_bool(
45 plot_audio_playout,
46 false,
47 "Plot bar graph showing the time between each audio playout.");
48WEBRTC_DEFINE_bool(
49 plot_audio_level,
50 false,
51 "Plot line graph showing the audio level of incoming audio.");
52WEBRTC_DEFINE_bool(
53 plot_incoming_sequence_number_delta,
54 false,
55 "Plot the sequence number difference between consecutive incoming "
56 "packets.");
57WEBRTC_DEFINE_bool(
terelius2ee076d2017-08-15 02:04:02 -070058 plot_incoming_delay_delta,
terelius54ce6802016-07-13 06:44:41 -070059 false,
60 "Plot the difference in 1-way path delay between consecutive packets.");
Mirko Bonadei5ccdc132018-10-18 11:35:32 +020061WEBRTC_DEFINE_bool(
62 plot_incoming_delay,
63 true,
64 "Plot the 1-way path delay for incoming packets, normalized so "
65 "that the first packet has delay 0.");
66WEBRTC_DEFINE_bool(
67 plot_incoming_loss_rate,
68 true,
69 "Compute the loss rate for incoming packets using a method that's "
70 "similar to the one used for RTCP SR and RR fraction lost. Note "
71 "that the loss rate can be negative if packets are duplicated or "
72 "reordered.");
73WEBRTC_DEFINE_bool(plot_incoming_bitrate,
74 true,
75 "Plot the total bitrate used by all incoming streams.");
76WEBRTC_DEFINE_bool(plot_outgoing_bitrate,
77 true,
78 "Plot the total bitrate used by all outgoing streams.");
79WEBRTC_DEFINE_bool(plot_incoming_stream_bitrate,
80 true,
81 "Plot the bitrate used by each incoming stream.");
82WEBRTC_DEFINE_bool(plot_outgoing_stream_bitrate,
83 true,
84 "Plot the bitrate used by each outgoing stream.");
85WEBRTC_DEFINE_bool(
86 plot_simulated_receiveside_bwe,
87 false,
88 "Run the receive-side bandwidth estimator with the incoming rtp "
89 "packets and plot the resulting estimate.");
90WEBRTC_DEFINE_bool(
91 plot_simulated_sendside_bwe,
92 false,
93 "Run the send-side bandwidth estimator with the outgoing rtp and "
94 "incoming rtcp and plot the resulting estimate.");
95WEBRTC_DEFINE_bool(
96 plot_network_delay_feedback,
97 true,
98 "Compute network delay based on sent packets and the received "
99 "transport feedback.");
100WEBRTC_DEFINE_bool(
101 plot_fraction_loss_feedback,
102 true,
103 "Plot packet loss in percent for outgoing packets (as perceived by "
104 "the send-side bandwidth estimator).");
105WEBRTC_DEFINE_bool(
106 plot_pacer_delay,
107 false,
108 "Plot the time each sent packet has spent in the pacer (based on "
109 "the difference between the RTP timestamp and the send "
110 "timestamp).");
111WEBRTC_DEFINE_bool(
112 plot_timestamps,
113 false,
114 "Plot the rtp timestamps of all rtp and rtcp packets over time.");
115WEBRTC_DEFINE_bool(
116 plot_rtcp_details,
117 false,
118 "Plot the contents of all report blocks in all sender and receiver "
119 "reports. This includes fraction lost, cumulative number of lost "
120 "packets, extended highest sequence number and time since last "
121 "received SR.");
122WEBRTC_DEFINE_bool(plot_audio_encoder_bitrate_bps,
123 false,
124 "Plot the audio encoder target bitrate.");
125WEBRTC_DEFINE_bool(plot_audio_encoder_frame_length_ms,
126 false,
127 "Plot the audio encoder frame length.");
128WEBRTC_DEFINE_bool(
terelius2ee076d2017-08-15 02:04:02 -0700129 plot_audio_encoder_packet_loss,
michaelt6e5b2192017-02-22 07:33:27 -0800130 false,
terelius2ee076d2017-08-15 02:04:02 -0700131 "Plot the uplink packet loss fraction which is sent to the audio encoder.");
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200132WEBRTC_DEFINE_bool(plot_audio_encoder_fec,
133 false,
134 "Plot the audio encoder FEC.");
135WEBRTC_DEFINE_bool(plot_audio_encoder_dtx,
136 false,
137 "Plot the audio encoder DTX.");
138WEBRTC_DEFINE_bool(plot_audio_encoder_num_channels,
139 false,
140 "Plot the audio encoder number of channels.");
141WEBRTC_DEFINE_bool(plot_neteq_stats, false, "Plot the NetEq statistics.");
142WEBRTC_DEFINE_bool(plot_ice_candidate_pair_config,
143 false,
144 "Plot the ICE candidate pair config events.");
145WEBRTC_DEFINE_bool(plot_ice_connectivity_check,
146 false,
147 "Plot the ICE candidate pair connectivity checks.");
Bjorn Terelius1edfff92017-10-11 13:15:19 +0200148
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200149WEBRTC_DEFINE_string(
stefan985d2802016-11-15 06:54:09 -0800150 force_fieldtrials,
151 "",
152 "Field trials control experimental feature code which can be forced. "
153 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
154 " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple "
155 "trials are separated by \"/\"");
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200156WEBRTC_DEFINE_string(wav_filename,
157 "",
158 "Path to wav file used for simulation of jitter buffer");
159WEBRTC_DEFINE_bool(help, false, "prints this message");
terelius54ce6802016-07-13 06:44:41 -0700160
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200161WEBRTC_DEFINE_bool(
162 show_detector_state,
163 false,
164 "Show the state of the delay based BWE detector on the total "
165 "bitrate graph");
terelius2ee076d2017-08-15 02:04:02 -0700166
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200167WEBRTC_DEFINE_bool(show_alr_state,
168 false,
169 "Show the state ALR state on the total bitrate graph");
Ilya Nikolaevskiya4259f62017-12-05 13:19:45 +0100170
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200171WEBRTC_DEFINE_bool(
172 parse_unconfigured_header_extensions,
173 true,
174 "Attempt to parse unconfigured header extensions using the default "
175 "WebRTC mapping. This can give very misleading results if the "
176 "application negotiates a different mapping.");
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200177
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200178WEBRTC_DEFINE_bool(print_triage_alerts,
179 false,
180 "Print triage alerts, i.e. a list of potential problems.");
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100181
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200182WEBRTC_DEFINE_bool(
183 normalize_time,
184 true,
185 "Normalize the log timestamps so that the call starts at time 0.");
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200186
Mirko Bonadei5ccdc132018-10-18 11:35:32 +0200187WEBRTC_DEFINE_bool(protobuf_output,
188 false,
189 "Output charts as protobuf instead of python code.");
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200190
terelius2ee076d2017-08-15 02:04:02 -0700191void SetAllPlotFlags(bool setting);
192
terelius54ce6802016-07-13 06:44:41 -0700193int main(int argc, char* argv[]) {
194 std::string program_name = argv[0];
195 std::string usage =
196 "A tool for visualizing WebRTC event logs.\n"
197 "Example usage:\n" +
198 program_name + " <logfile> | python\n" + "Run " + program_name +
199 " --help for a list of command line options\n";
terelius2ee076d2017-08-15 02:04:02 -0700200
201 // Parse command line flags without removing them. We're only interested in
202 // the |plot_profile| flag.
203 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false);
204 if (strcmp(FLAG_plot_profile, "all") == 0) {
205 SetAllPlotFlags(true);
206 } else if (strcmp(FLAG_plot_profile, "none") == 0) {
207 SetAllPlotFlags(false);
Bjorn Terelius1edfff92017-10-11 13:15:19 +0200208 } else if (strcmp(FLAG_plot_profile, "sendside_bwe") == 0) {
209 SetAllPlotFlags(false);
210 FLAG_plot_outgoing_packet_sizes = true;
211 FLAG_plot_outgoing_bitrate = true;
212 FLAG_plot_outgoing_stream_bitrate = true;
213 FLAG_plot_simulated_sendside_bwe = true;
214 FLAG_plot_network_delay_feedback = true;
215 FLAG_plot_fraction_loss_feedback = true;
216 } else if (strcmp(FLAG_plot_profile, "receiveside_bwe") == 0) {
217 SetAllPlotFlags(false);
218 FLAG_plot_incoming_packet_sizes = true;
219 FLAG_plot_incoming_delay_delta = true;
220 FLAG_plot_incoming_delay = true;
221 FLAG_plot_incoming_loss_rate = true;
222 FLAG_plot_incoming_bitrate = true;
223 FLAG_plot_incoming_stream_bitrate = true;
224 FLAG_plot_simulated_receiveside_bwe = true;
terelius2ee076d2017-08-15 02:04:02 -0700225 } else if (strcmp(FLAG_plot_profile, "default") == 0) {
226 // Do nothing.
227 } else {
228 rtc::Flag* plot_profile_flag = rtc::FlagList::Lookup("plot_profile");
229 RTC_CHECK(plot_profile_flag);
230 plot_profile_flag->Print(false);
231 }
232 // Parse the remaining flags. They are applied relative to the chosen profile.
kjellander4fa5be42017-05-16 00:01:23 -0700233 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
terelius2ee076d2017-08-15 02:04:02 -0700234
tereliusc4a5c142017-07-20 08:05:09 -0700235 if (argc != 2 || FLAG_help) {
kjellander4fa5be42017-05-16 00:01:23 -0700236 // Print usage information.
237 std::cout << usage;
tereliusc4a5c142017-07-20 08:05:09 -0700238 if (FLAG_help)
239 rtc::FlagList::Print(nullptr, false);
kjellander4fa5be42017-05-16 00:01:23 -0700240 return 0;
241 }
242
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100243 webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials);
244 // InitFieldTrialsFromString stores the char*, so the char array must outlive
245 // the application.
246 webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
stefan985d2802016-11-15 06:54:09 -0800247
terelius54ce6802016-07-13 06:44:41 -0700248 std::string filename = argv[1];
249
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200250 webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions header_extensions =
251 webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions::kDontParse;
252 if (FLAG_parse_unconfigured_header_extensions) {
253 header_extensions = webrtc::ParsedRtcEventLogNew::
254 UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig;
255 }
256 webrtc::ParsedRtcEventLogNew parsed_log(header_extensions);
terelius54ce6802016-07-13 06:44:41 -0700257
258 if (!parsed_log.ParseFile(filename)) {
259 std::cerr << "Could not parse the entire log file." << std::endl;
260 std::cerr << "Proceeding to analyze the first "
261 << parsed_log.GetNumberOfEvents() << " events in the file."
262 << std::endl;
263 }
264
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200265 webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time);
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200266 std::unique_ptr<webrtc::PlotCollection> collection;
267 if (FLAG_protobuf_output) {
268 collection.reset(new webrtc::ProtobufPlotCollection());
269 } else {
270 collection.reset(new webrtc::PythonPlotCollection());
271 }
terelius54ce6802016-07-13 06:44:41 -0700272
terelius2ee076d2017-08-15 02:04:02 -0700273 if (FLAG_plot_incoming_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200274 analyzer.CreatePacketGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700275 collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700276 }
terelius2ee076d2017-08-15 02:04:02 -0700277 if (FLAG_plot_outgoing_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200278 analyzer.CreatePacketGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700279 collection->AppendNewPlot());
280 }
281 if (FLAG_plot_incoming_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200282 analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket,
283 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700284 }
285 if (FLAG_plot_outgoing_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200286 analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket,
287 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700288 }
289 if (FLAG_plot_audio_playout) {
tereliusdc35dcd2016-08-01 12:03:27 -0700290 analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700291 }
terelius2ee076d2017-08-15 02:04:02 -0700292 if (FLAG_plot_audio_level) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200293 analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket,
294 collection->AppendNewPlot());
295 analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket,
296 collection->AppendNewPlot());
ivocaac9d6f2016-09-22 07:01:47 -0700297 }
terelius2ee076d2017-08-15 02:04:02 -0700298 if (FLAG_plot_incoming_sequence_number_delta) {
299 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700300 }
terelius2ee076d2017-08-15 02:04:02 -0700301 if (FLAG_plot_incoming_delay_delta) {
302 analyzer.CreateIncomingDelayDeltaGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700303 }
terelius2ee076d2017-08-15 02:04:02 -0700304 if (FLAG_plot_incoming_delay) {
305 analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700306 }
terelius2ee076d2017-08-15 02:04:02 -0700307 if (FLAG_plot_incoming_loss_rate) {
Stefan Holmer99f8e082016-09-09 13:37:50 +0200308 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
tereliusf736d232016-08-04 10:00:11 -0700309 }
terelius2ee076d2017-08-15 02:04:02 -0700310 if (FLAG_plot_incoming_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200311 analyzer.CreateTotalIncomingBitrateGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700312 }
terelius2ee076d2017-08-15 02:04:02 -0700313 if (FLAG_plot_outgoing_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200314 analyzer.CreateTotalOutgoingBitrateGraph(collection->AppendNewPlot(),
315 FLAG_show_detector_state,
316 FLAG_show_alr_state);
terelius54ce6802016-07-13 06:44:41 -0700317 }
terelius2ee076d2017-08-15 02:04:02 -0700318 if (FLAG_plot_incoming_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200319 analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700320 collection->AppendNewPlot());
321 }
322 if (FLAG_plot_outgoing_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200323 analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700324 collection->AppendNewPlot());
325 }
Bjorn Terelius28db2662017-10-04 14:22:43 +0200326 if (FLAG_plot_simulated_receiveside_bwe) {
327 analyzer.CreateReceiveSideBweSimulationGraph(collection->AppendNewPlot());
328 }
terelius2ee076d2017-08-15 02:04:02 -0700329 if (FLAG_plot_simulated_sendside_bwe) {
Bjorn Terelius28db2662017-10-04 14:22:43 +0200330 analyzer.CreateSendSideBweSimulationGraph(collection->AppendNewPlot());
Stefan Holmer13181032016-07-29 14:48:54 +0200331 }
terelius2ee076d2017-08-15 02:04:02 -0700332 if (FLAG_plot_network_delay_feedback) {
tereliuse34c19c2016-08-15 08:47:14 -0700333 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
stefanc3de0332016-08-02 07:22:17 -0700334 }
terelius2ee076d2017-08-15 02:04:02 -0700335 if (FLAG_plot_fraction_loss_feedback) {
336 analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
337 }
338 if (FLAG_plot_timestamps) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200339 analyzer.CreateTimestampGraph(webrtc::kIncomingPacket,
340 collection->AppendNewPlot());
341 analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket,
342 collection->AppendNewPlot());
stefane372d3c2017-02-02 08:04:18 -0800343 }
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200344 if (FLAG_plot_rtcp_details) {
345 auto GetFractionLost = [](const webrtc::rtcp::ReportBlock& block) -> float {
346 return static_cast<double>(block.fraction_lost()) / 256 * 100;
347 };
348 analyzer.CreateSenderAndReceiverReportPlot(
349 webrtc::kIncomingPacket, GetFractionLost,
350 "Fraction lost (incoming RTCP)", "Loss rate (percent)",
351 collection->AppendNewPlot());
352 analyzer.CreateSenderAndReceiverReportPlot(
353 webrtc::kOutgoingPacket, GetFractionLost,
354 "Fraction lost (outgoing RTCP)", "Loss rate (percent)",
355 collection->AppendNewPlot());
356
357 auto GetCumulativeLost =
358 [](const webrtc::rtcp::ReportBlock& block) -> float {
359 return block.cumulative_lost_signed();
360 };
361 analyzer.CreateSenderAndReceiverReportPlot(
362 webrtc::kIncomingPacket, GetCumulativeLost,
363 "Cumulative lost packets (incoming RTCP)", "Packets",
364 collection->AppendNewPlot());
365 analyzer.CreateSenderAndReceiverReportPlot(
366 webrtc::kOutgoingPacket, GetCumulativeLost,
367 "Cumulative lost packets (outgoing RTCP)", "Packets",
368 collection->AppendNewPlot());
369
370 auto GetHighestSeqNumber =
371 [](const webrtc::rtcp::ReportBlock& block) -> float {
372 return block.extended_high_seq_num();
373 };
374 analyzer.CreateSenderAndReceiverReportPlot(
375 webrtc::kIncomingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200376 "Highest sequence number (incoming RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200377 collection->AppendNewPlot());
378 analyzer.CreateSenderAndReceiverReportPlot(
379 webrtc::kOutgoingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200380 "Highest sequence number (outgoing RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200381 collection->AppendNewPlot());
382
383 auto DelaySinceLastSr =
384 [](const webrtc::rtcp::ReportBlock& block) -> float {
385 return static_cast<double>(block.delay_since_last_sr()) / 65536;
386 };
387 analyzer.CreateSenderAndReceiverReportPlot(
388 webrtc::kIncomingPacket, DelaySinceLastSr,
389 "Delay since last received sender report (incoming RTCP)", "Time (s)",
390 collection->AppendNewPlot());
391 analyzer.CreateSenderAndReceiverReportPlot(
392 webrtc::kOutgoingPacket, DelaySinceLastSr,
393 "Delay since last received sender report (outgoing RTCP)", "Time (s)",
394 collection->AppendNewPlot());
395 }
396
Bjorn Terelius0295a962017-10-25 17:42:41 +0200397 if (FLAG_plot_pacer_delay) {
398 analyzer.CreatePacerDelayGraph(collection->AppendNewPlot());
399 }
terelius2ee076d2017-08-15 02:04:02 -0700400 if (FLAG_plot_audio_encoder_bitrate_bps) {
michaelt6e5b2192017-02-22 07:33:27 -0800401 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
402 }
terelius2ee076d2017-08-15 02:04:02 -0700403 if (FLAG_plot_audio_encoder_frame_length_ms) {
michaelt6e5b2192017-02-22 07:33:27 -0800404 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
405 }
terelius2ee076d2017-08-15 02:04:02 -0700406 if (FLAG_plot_audio_encoder_packet_loss) {
407 analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot());
michaelt6e5b2192017-02-22 07:33:27 -0800408 }
terelius2ee076d2017-08-15 02:04:02 -0700409 if (FLAG_plot_audio_encoder_fec) {
michaelt6e5b2192017-02-22 07:33:27 -0800410 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
411 }
terelius2ee076d2017-08-15 02:04:02 -0700412 if (FLAG_plot_audio_encoder_dtx) {
michaelt6e5b2192017-02-22 07:33:27 -0800413 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
414 }
terelius2ee076d2017-08-15 02:04:02 -0700415 if (FLAG_plot_audio_encoder_num_channels) {
michaelt6e5b2192017-02-22 07:33:27 -0800416 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
417 }
Minyue Li27e2b7d2018-05-07 15:20:24 +0200418 if (FLAG_plot_neteq_stats) {
owb7fbeb0b2017-08-16 02:48:33 -0700419 std::string wav_path;
420 if (FLAG_wav_filename[0] != '\0') {
421 wav_path = FLAG_wav_filename;
422 } else {
423 wav_path = webrtc::test::ResourcePath(
424 "audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav");
425 }
Minyue Lic6ff7572018-05-04 09:46:44 +0200426 auto neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
Minyue Li01d2a672018-06-21 21:17:19 +0200427 for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it =
428 neteq_stats.cbegin();
429 it != neteq_stats.cend(); ++it) {
430 analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(),
Minyue Li45fc6df2018-06-21 11:47:14 +0200431 collection->AppendNewPlot());
432 }
Minyue Lic9ac93f2018-06-26 13:01:32 +0200433 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200434 neteq_stats,
435 [](const webrtc::NetEqNetworkStatistics& stats) {
436 return stats.expand_rate / 16384.f;
437 },
438 "Expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200439 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200440 neteq_stats,
441 [](const webrtc::NetEqNetworkStatistics& stats) {
442 return stats.speech_expand_rate / 16384.f;
443 },
444 "Speech expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200445 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200446 neteq_stats,
447 [](const webrtc::NetEqNetworkStatistics& stats) {
448 return stats.accelerate_rate / 16384.f;
449 },
450 "Accelerate rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200451 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200452 neteq_stats,
453 [](const webrtc::NetEqNetworkStatistics& stats) {
454 return stats.packet_loss_rate / 16384.f;
455 },
456 "Packet loss rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200457 analyzer.CreateNetEqLifetimeStatsGraph(
458 neteq_stats,
459 [](const webrtc::NetEqLifetimeStatistics& stats) {
460 return static_cast<float>(stats.concealment_events);
461 },
462 "Concealment events", collection->AppendNewPlot());
henrik.lundin3c938fc2017-06-14 06:09:58 -0700463 }
464
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800465 if (FLAG_plot_ice_candidate_pair_config) {
466 analyzer.CreateIceCandidatePairConfigGraph(collection->AppendNewPlot());
467 }
468 if (FLAG_plot_ice_connectivity_check) {
469 analyzer.CreateIceConnectivityCheckGraph(collection->AppendNewPlot());
470 }
471
tereliusdc35dcd2016-08-01 12:03:27 -0700472 collection->Draw();
terelius54ce6802016-07-13 06:44:41 -0700473
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200474 if (FLAG_print_triage_alerts) {
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100475 analyzer.CreateTriageNotifications();
476 analyzer.PrintNotifications(stderr);
477 }
478
terelius54ce6802016-07-13 06:44:41 -0700479 return 0;
480}
terelius2ee076d2017-08-15 02:04:02 -0700481
terelius2ee076d2017-08-15 02:04:02 -0700482void SetAllPlotFlags(bool setting) {
483 FLAG_plot_incoming_packet_sizes = setting;
484 FLAG_plot_outgoing_packet_sizes = setting;
485 FLAG_plot_incoming_packet_count = setting;
486 FLAG_plot_outgoing_packet_count = setting;
487 FLAG_plot_audio_playout = setting;
488 FLAG_plot_audio_level = setting;
489 FLAG_plot_incoming_sequence_number_delta = setting;
490 FLAG_plot_incoming_delay_delta = setting;
491 FLAG_plot_incoming_delay = setting;
492 FLAG_plot_incoming_loss_rate = setting;
493 FLAG_plot_incoming_bitrate = setting;
494 FLAG_plot_outgoing_bitrate = setting;
495 FLAG_plot_incoming_stream_bitrate = setting;
496 FLAG_plot_outgoing_stream_bitrate = setting;
Bjorn Terelius28db2662017-10-04 14:22:43 +0200497 FLAG_plot_simulated_receiveside_bwe = setting;
terelius2ee076d2017-08-15 02:04:02 -0700498 FLAG_plot_simulated_sendside_bwe = setting;
499 FLAG_plot_network_delay_feedback = setting;
500 FLAG_plot_fraction_loss_feedback = setting;
501 FLAG_plot_timestamps = setting;
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200502 FLAG_plot_rtcp_details = setting;
terelius2ee076d2017-08-15 02:04:02 -0700503 FLAG_plot_audio_encoder_bitrate_bps = setting;
504 FLAG_plot_audio_encoder_frame_length_ms = setting;
505 FLAG_plot_audio_encoder_packet_loss = setting;
506 FLAG_plot_audio_encoder_fec = setting;
507 FLAG_plot_audio_encoder_dtx = setting;
508 FLAG_plot_audio_encoder_num_channels = setting;
Minyue Li27e2b7d2018-05-07 15:20:24 +0200509 FLAG_plot_neteq_stats = setting;
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800510 FLAG_plot_ice_candidate_pair_config = setting;
511 FLAG_plot_ice_connectivity_check = setting;
terelius2ee076d2017-08-15 02:04:02 -0700512}