blob: 0b4e7617e6068d756f390f4be2c74cc91ebca620 [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 Bonadei2dfa9982018-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 Bonadei2dfa9982018-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(
Mirko Bonadei2dfa9982018-10-18 11:35:32 +020058 plot_incoming_delay,
59 true,
60 "Plot the 1-way path delay for incoming packets, normalized so "
61 "that the first packet has delay 0.");
62WEBRTC_DEFINE_bool(
63 plot_incoming_loss_rate,
64 true,
65 "Compute the loss rate for incoming packets using a method that's "
66 "similar to the one used for RTCP SR and RR fraction lost. Note "
67 "that the loss rate can be negative if packets are duplicated or "
68 "reordered.");
69WEBRTC_DEFINE_bool(plot_incoming_bitrate,
70 true,
71 "Plot the total bitrate used by all incoming streams.");
72WEBRTC_DEFINE_bool(plot_outgoing_bitrate,
73 true,
74 "Plot the total bitrate used by all outgoing streams.");
75WEBRTC_DEFINE_bool(plot_incoming_stream_bitrate,
76 true,
77 "Plot the bitrate used by each incoming stream.");
78WEBRTC_DEFINE_bool(plot_outgoing_stream_bitrate,
79 true,
80 "Plot the bitrate used by each outgoing stream.");
81WEBRTC_DEFINE_bool(
82 plot_simulated_receiveside_bwe,
83 false,
84 "Run the receive-side bandwidth estimator with the incoming rtp "
85 "packets and plot the resulting estimate.");
86WEBRTC_DEFINE_bool(
87 plot_simulated_sendside_bwe,
88 false,
89 "Run the send-side bandwidth estimator with the outgoing rtp and "
90 "incoming rtcp and plot the resulting estimate.");
91WEBRTC_DEFINE_bool(
92 plot_network_delay_feedback,
93 true,
94 "Compute network delay based on sent packets and the received "
95 "transport feedback.");
96WEBRTC_DEFINE_bool(
97 plot_fraction_loss_feedback,
98 true,
99 "Plot packet loss in percent for outgoing packets (as perceived by "
100 "the send-side bandwidth estimator).");
101WEBRTC_DEFINE_bool(
102 plot_pacer_delay,
103 false,
104 "Plot the time each sent packet has spent in the pacer (based on "
105 "the difference between the RTP timestamp and the send "
106 "timestamp).");
107WEBRTC_DEFINE_bool(
108 plot_timestamps,
109 false,
110 "Plot the rtp timestamps of all rtp and rtcp packets over time.");
111WEBRTC_DEFINE_bool(
112 plot_rtcp_details,
113 false,
114 "Plot the contents of all report blocks in all sender and receiver "
115 "reports. This includes fraction lost, cumulative number of lost "
116 "packets, extended highest sequence number and time since last "
117 "received SR.");
118WEBRTC_DEFINE_bool(plot_audio_encoder_bitrate_bps,
119 false,
120 "Plot the audio encoder target bitrate.");
121WEBRTC_DEFINE_bool(plot_audio_encoder_frame_length_ms,
122 false,
123 "Plot the audio encoder frame length.");
124WEBRTC_DEFINE_bool(
terelius2ee076d2017-08-15 02:04:02 -0700125 plot_audio_encoder_packet_loss,
michaelt6e5b2192017-02-22 07:33:27 -0800126 false,
terelius2ee076d2017-08-15 02:04:02 -0700127 "Plot the uplink packet loss fraction which is sent to the audio encoder.");
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200128WEBRTC_DEFINE_bool(plot_audio_encoder_fec,
129 false,
130 "Plot the audio encoder FEC.");
131WEBRTC_DEFINE_bool(plot_audio_encoder_dtx,
132 false,
133 "Plot the audio encoder DTX.");
134WEBRTC_DEFINE_bool(plot_audio_encoder_num_channels,
135 false,
136 "Plot the audio encoder number of channels.");
137WEBRTC_DEFINE_bool(plot_neteq_stats, false, "Plot the NetEq statistics.");
138WEBRTC_DEFINE_bool(plot_ice_candidate_pair_config,
139 false,
140 "Plot the ICE candidate pair config events.");
141WEBRTC_DEFINE_bool(plot_ice_connectivity_check,
142 false,
143 "Plot the ICE candidate pair connectivity checks.");
Bjorn Terelius1edfff92017-10-11 13:15:19 +0200144
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200145WEBRTC_DEFINE_string(
stefan985d2802016-11-15 06:54:09 -0800146 force_fieldtrials,
147 "",
148 "Field trials control experimental feature code which can be forced. "
149 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
150 " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple "
151 "trials are separated by \"/\"");
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200152WEBRTC_DEFINE_string(wav_filename,
153 "",
154 "Path to wav file used for simulation of jitter buffer");
155WEBRTC_DEFINE_bool(help, false, "prints this message");
terelius54ce6802016-07-13 06:44:41 -0700156
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200157WEBRTC_DEFINE_bool(
158 show_detector_state,
159 false,
160 "Show the state of the delay based BWE detector on the total "
161 "bitrate graph");
terelius2ee076d2017-08-15 02:04:02 -0700162
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200163WEBRTC_DEFINE_bool(show_alr_state,
164 false,
165 "Show the state ALR state on the total bitrate graph");
Ilya Nikolaevskiya4259f62017-12-05 13:19:45 +0100166
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200167WEBRTC_DEFINE_bool(
168 parse_unconfigured_header_extensions,
169 true,
170 "Attempt to parse unconfigured header extensions using the default "
171 "WebRTC mapping. This can give very misleading results if the "
172 "application negotiates a different mapping.");
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200173
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200174WEBRTC_DEFINE_bool(print_triage_alerts,
175 false,
176 "Print triage alerts, i.e. a list of potential problems.");
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100177
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200178WEBRTC_DEFINE_bool(
179 normalize_time,
180 true,
181 "Normalize the log timestamps so that the call starts at time 0.");
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200182
Mirko Bonadei2dfa9982018-10-18 11:35:32 +0200183WEBRTC_DEFINE_bool(protobuf_output,
184 false,
185 "Output charts as protobuf instead of python code.");
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200186
terelius2ee076d2017-08-15 02:04:02 -0700187void SetAllPlotFlags(bool setting);
188
terelius54ce6802016-07-13 06:44:41 -0700189int main(int argc, char* argv[]) {
190 std::string program_name = argv[0];
191 std::string usage =
192 "A tool for visualizing WebRTC event logs.\n"
193 "Example usage:\n" +
194 program_name + " <logfile> | python\n" + "Run " + program_name +
195 " --help for a list of command line options\n";
terelius2ee076d2017-08-15 02:04:02 -0700196
197 // Parse command line flags without removing them. We're only interested in
198 // the |plot_profile| flag.
199 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false);
200 if (strcmp(FLAG_plot_profile, "all") == 0) {
201 SetAllPlotFlags(true);
202 } else if (strcmp(FLAG_plot_profile, "none") == 0) {
203 SetAllPlotFlags(false);
Bjorn Terelius1edfff92017-10-11 13:15:19 +0200204 } else if (strcmp(FLAG_plot_profile, "sendside_bwe") == 0) {
205 SetAllPlotFlags(false);
206 FLAG_plot_outgoing_packet_sizes = true;
207 FLAG_plot_outgoing_bitrate = true;
208 FLAG_plot_outgoing_stream_bitrate = true;
209 FLAG_plot_simulated_sendside_bwe = true;
210 FLAG_plot_network_delay_feedback = true;
211 FLAG_plot_fraction_loss_feedback = true;
212 } else if (strcmp(FLAG_plot_profile, "receiveside_bwe") == 0) {
213 SetAllPlotFlags(false);
214 FLAG_plot_incoming_packet_sizes = true;
Bjorn Terelius1edfff92017-10-11 13:15:19 +0200215 FLAG_plot_incoming_delay = true;
216 FLAG_plot_incoming_loss_rate = true;
217 FLAG_plot_incoming_bitrate = true;
218 FLAG_plot_incoming_stream_bitrate = true;
219 FLAG_plot_simulated_receiveside_bwe = true;
terelius2ee076d2017-08-15 02:04:02 -0700220 } else if (strcmp(FLAG_plot_profile, "default") == 0) {
221 // Do nothing.
222 } else {
223 rtc::Flag* plot_profile_flag = rtc::FlagList::Lookup("plot_profile");
224 RTC_CHECK(plot_profile_flag);
225 plot_profile_flag->Print(false);
226 }
227 // Parse the remaining flags. They are applied relative to the chosen profile.
kjellander4fa5be42017-05-16 00:01:23 -0700228 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
terelius2ee076d2017-08-15 02:04:02 -0700229
tereliusc4a5c142017-07-20 08:05:09 -0700230 if (argc != 2 || FLAG_help) {
kjellander4fa5be42017-05-16 00:01:23 -0700231 // Print usage information.
232 std::cout << usage;
tereliusc4a5c142017-07-20 08:05:09 -0700233 if (FLAG_help)
234 rtc::FlagList::Print(nullptr, false);
kjellander4fa5be42017-05-16 00:01:23 -0700235 return 0;
236 }
237
Bjorn Tereliusedab3012018-01-31 17:23:40 +0100238 webrtc::test::ValidateFieldTrialsStringOrDie(FLAG_force_fieldtrials);
239 // InitFieldTrialsFromString stores the char*, so the char array must outlive
240 // the application.
241 webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
stefan985d2802016-11-15 06:54:09 -0800242
terelius54ce6802016-07-13 06:44:41 -0700243 std::string filename = argv[1];
244
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200245 webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions header_extensions =
246 webrtc::ParsedRtcEventLogNew::UnconfiguredHeaderExtensions::kDontParse;
247 if (FLAG_parse_unconfigured_header_extensions) {
248 header_extensions = webrtc::ParsedRtcEventLogNew::
249 UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig;
250 }
251 webrtc::ParsedRtcEventLogNew parsed_log(header_extensions);
terelius54ce6802016-07-13 06:44:41 -0700252
253 if (!parsed_log.ParseFile(filename)) {
254 std::cerr << "Could not parse the entire log file." << std::endl;
Bjorn Tereliusfdc635d2018-11-14 13:40:13 +0100255 std::cerr << "Only the parsable events will be analyzed." << std::endl;
terelius54ce6802016-07-13 06:44:41 -0700256 }
257
Stefan Holmer1d4a2272018-05-24 13:48:09 +0200258 webrtc::EventLogAnalyzer analyzer(parsed_log, FLAG_normalize_time);
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200259 std::unique_ptr<webrtc::PlotCollection> collection;
260 if (FLAG_protobuf_output) {
261 collection.reset(new webrtc::ProtobufPlotCollection());
262 } else {
263 collection.reset(new webrtc::PythonPlotCollection());
264 }
terelius54ce6802016-07-13 06:44:41 -0700265
terelius2ee076d2017-08-15 02:04:02 -0700266 if (FLAG_plot_incoming_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200267 analyzer.CreatePacketGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700268 collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700269 }
terelius2ee076d2017-08-15 02:04:02 -0700270 if (FLAG_plot_outgoing_packet_sizes) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200271 analyzer.CreatePacketGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700272 collection->AppendNewPlot());
273 }
274 if (FLAG_plot_incoming_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200275 analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket,
276 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700277 }
278 if (FLAG_plot_outgoing_packet_count) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200279 analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket,
280 collection->AppendNewPlot());
terelius2ee076d2017-08-15 02:04:02 -0700281 }
282 if (FLAG_plot_audio_playout) {
tereliusdc35dcd2016-08-01 12:03:27 -0700283 analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700284 }
terelius2ee076d2017-08-15 02:04:02 -0700285 if (FLAG_plot_audio_level) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200286 analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket,
287 collection->AppendNewPlot());
288 analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket,
289 collection->AppendNewPlot());
ivocaac9d6f2016-09-22 07:01:47 -0700290 }
terelius2ee076d2017-08-15 02:04:02 -0700291 if (FLAG_plot_incoming_sequence_number_delta) {
292 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700293 }
terelius2ee076d2017-08-15 02:04:02 -0700294 if (FLAG_plot_incoming_delay) {
295 analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700296 }
terelius2ee076d2017-08-15 02:04:02 -0700297 if (FLAG_plot_incoming_loss_rate) {
Stefan Holmer99f8e082016-09-09 13:37:50 +0200298 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
tereliusf736d232016-08-04 10:00:11 -0700299 }
terelius2ee076d2017-08-15 02:04:02 -0700300 if (FLAG_plot_incoming_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200301 analyzer.CreateTotalIncomingBitrateGraph(collection->AppendNewPlot());
terelius54ce6802016-07-13 06:44:41 -0700302 }
terelius2ee076d2017-08-15 02:04:02 -0700303 if (FLAG_plot_outgoing_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200304 analyzer.CreateTotalOutgoingBitrateGraph(collection->AppendNewPlot(),
305 FLAG_show_detector_state,
306 FLAG_show_alr_state);
terelius54ce6802016-07-13 06:44:41 -0700307 }
terelius2ee076d2017-08-15 02:04:02 -0700308 if (FLAG_plot_incoming_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200309 analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700310 collection->AppendNewPlot());
311 }
312 if (FLAG_plot_outgoing_stream_bitrate) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200313 analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket,
terelius2ee076d2017-08-15 02:04:02 -0700314 collection->AppendNewPlot());
315 }
Bjorn Terelius28db2662017-10-04 14:22:43 +0200316 if (FLAG_plot_simulated_receiveside_bwe) {
317 analyzer.CreateReceiveSideBweSimulationGraph(collection->AppendNewPlot());
318 }
terelius2ee076d2017-08-15 02:04:02 -0700319 if (FLAG_plot_simulated_sendside_bwe) {
Bjorn Terelius28db2662017-10-04 14:22:43 +0200320 analyzer.CreateSendSideBweSimulationGraph(collection->AppendNewPlot());
Stefan Holmer13181032016-07-29 14:48:54 +0200321 }
terelius2ee076d2017-08-15 02:04:02 -0700322 if (FLAG_plot_network_delay_feedback) {
tereliuse34c19c2016-08-15 08:47:14 -0700323 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
stefanc3de0332016-08-02 07:22:17 -0700324 }
terelius2ee076d2017-08-15 02:04:02 -0700325 if (FLAG_plot_fraction_loss_feedback) {
326 analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
327 }
328 if (FLAG_plot_timestamps) {
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200329 analyzer.CreateTimestampGraph(webrtc::kIncomingPacket,
330 collection->AppendNewPlot());
331 analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket,
332 collection->AppendNewPlot());
stefane372d3c2017-02-02 08:04:18 -0800333 }
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200334 if (FLAG_plot_rtcp_details) {
335 auto GetFractionLost = [](const webrtc::rtcp::ReportBlock& block) -> float {
336 return static_cast<double>(block.fraction_lost()) / 256 * 100;
337 };
338 analyzer.CreateSenderAndReceiverReportPlot(
339 webrtc::kIncomingPacket, GetFractionLost,
340 "Fraction lost (incoming RTCP)", "Loss rate (percent)",
341 collection->AppendNewPlot());
342 analyzer.CreateSenderAndReceiverReportPlot(
343 webrtc::kOutgoingPacket, GetFractionLost,
344 "Fraction lost (outgoing RTCP)", "Loss rate (percent)",
345 collection->AppendNewPlot());
346
347 auto GetCumulativeLost =
348 [](const webrtc::rtcp::ReportBlock& block) -> float {
349 return block.cumulative_lost_signed();
350 };
351 analyzer.CreateSenderAndReceiverReportPlot(
352 webrtc::kIncomingPacket, GetCumulativeLost,
353 "Cumulative lost packets (incoming RTCP)", "Packets",
354 collection->AppendNewPlot());
355 analyzer.CreateSenderAndReceiverReportPlot(
356 webrtc::kOutgoingPacket, GetCumulativeLost,
357 "Cumulative lost packets (outgoing RTCP)", "Packets",
358 collection->AppendNewPlot());
359
360 auto GetHighestSeqNumber =
361 [](const webrtc::rtcp::ReportBlock& block) -> float {
362 return block.extended_high_seq_num();
363 };
364 analyzer.CreateSenderAndReceiverReportPlot(
365 webrtc::kIncomingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200366 "Highest sequence number (incoming RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200367 collection->AppendNewPlot());
368 analyzer.CreateSenderAndReceiverReportPlot(
369 webrtc::kOutgoingPacket, GetHighestSeqNumber,
Bjorn Tereliusef73f592018-09-10 20:11:49 +0200370 "Highest sequence number (outgoing RTCP)", "Sequence number",
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200371 collection->AppendNewPlot());
372
373 auto DelaySinceLastSr =
374 [](const webrtc::rtcp::ReportBlock& block) -> float {
375 return static_cast<double>(block.delay_since_last_sr()) / 65536;
376 };
377 analyzer.CreateSenderAndReceiverReportPlot(
378 webrtc::kIncomingPacket, DelaySinceLastSr,
379 "Delay since last received sender report (incoming RTCP)", "Time (s)",
380 collection->AppendNewPlot());
381 analyzer.CreateSenderAndReceiverReportPlot(
382 webrtc::kOutgoingPacket, DelaySinceLastSr,
383 "Delay since last received sender report (outgoing RTCP)", "Time (s)",
384 collection->AppendNewPlot());
385 }
386
Bjorn Terelius0295a962017-10-25 17:42:41 +0200387 if (FLAG_plot_pacer_delay) {
388 analyzer.CreatePacerDelayGraph(collection->AppendNewPlot());
389 }
terelius2ee076d2017-08-15 02:04:02 -0700390 if (FLAG_plot_audio_encoder_bitrate_bps) {
michaelt6e5b2192017-02-22 07:33:27 -0800391 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
392 }
terelius2ee076d2017-08-15 02:04:02 -0700393 if (FLAG_plot_audio_encoder_frame_length_ms) {
michaelt6e5b2192017-02-22 07:33:27 -0800394 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
395 }
terelius2ee076d2017-08-15 02:04:02 -0700396 if (FLAG_plot_audio_encoder_packet_loss) {
397 analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot());
michaelt6e5b2192017-02-22 07:33:27 -0800398 }
terelius2ee076d2017-08-15 02:04:02 -0700399 if (FLAG_plot_audio_encoder_fec) {
michaelt6e5b2192017-02-22 07:33:27 -0800400 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
401 }
terelius2ee076d2017-08-15 02:04:02 -0700402 if (FLAG_plot_audio_encoder_dtx) {
michaelt6e5b2192017-02-22 07:33:27 -0800403 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
404 }
terelius2ee076d2017-08-15 02:04:02 -0700405 if (FLAG_plot_audio_encoder_num_channels) {
michaelt6e5b2192017-02-22 07:33:27 -0800406 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
407 }
Minyue Li27e2b7d2018-05-07 15:20:24 +0200408 if (FLAG_plot_neteq_stats) {
owb7fbeb0b2017-08-16 02:48:33 -0700409 std::string wav_path;
410 if (FLAG_wav_filename[0] != '\0') {
411 wav_path = FLAG_wav_filename;
412 } else {
413 wav_path = webrtc::test::ResourcePath(
414 "audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav");
415 }
Minyue Lic6ff7572018-05-04 09:46:44 +0200416 auto neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
Minyue Li01d2a672018-06-21 21:17:19 +0200417 for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it =
418 neteq_stats.cbegin();
419 it != neteq_stats.cend(); ++it) {
420 analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(),
Minyue Li45fc6df2018-06-21 11:47:14 +0200421 collection->AppendNewPlot());
422 }
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.expand_rate / 16384.f;
427 },
428 "Expand 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.speech_expand_rate / 16384.f;
433 },
434 "Speech expand rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200435 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200436 neteq_stats,
437 [](const webrtc::NetEqNetworkStatistics& stats) {
438 return stats.accelerate_rate / 16384.f;
439 },
440 "Accelerate rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200441 analyzer.CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +0200442 neteq_stats,
443 [](const webrtc::NetEqNetworkStatistics& stats) {
444 return stats.packet_loss_rate / 16384.f;
445 },
446 "Packet loss rate", collection->AppendNewPlot());
Minyue Lic9ac93f2018-06-26 13:01:32 +0200447 analyzer.CreateNetEqLifetimeStatsGraph(
448 neteq_stats,
449 [](const webrtc::NetEqLifetimeStatistics& stats) {
450 return static_cast<float>(stats.concealment_events);
451 },
452 "Concealment events", collection->AppendNewPlot());
henrik.lundin3c938fc2017-06-14 06:09:58 -0700453 }
454
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800455 if (FLAG_plot_ice_candidate_pair_config) {
456 analyzer.CreateIceCandidatePairConfigGraph(collection->AppendNewPlot());
457 }
458 if (FLAG_plot_ice_connectivity_check) {
459 analyzer.CreateIceConnectivityCheckGraph(collection->AppendNewPlot());
460 }
461
tereliusdc35dcd2016-08-01 12:03:27 -0700462 collection->Draw();
terelius54ce6802016-07-13 06:44:41 -0700463
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200464 if (FLAG_print_triage_alerts) {
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100465 analyzer.CreateTriageNotifications();
466 analyzer.PrintNotifications(stderr);
467 }
468
terelius54ce6802016-07-13 06:44:41 -0700469 return 0;
470}
terelius2ee076d2017-08-15 02:04:02 -0700471
terelius2ee076d2017-08-15 02:04:02 -0700472void SetAllPlotFlags(bool setting) {
473 FLAG_plot_incoming_packet_sizes = setting;
474 FLAG_plot_outgoing_packet_sizes = setting;
475 FLAG_plot_incoming_packet_count = setting;
476 FLAG_plot_outgoing_packet_count = setting;
477 FLAG_plot_audio_playout = setting;
478 FLAG_plot_audio_level = setting;
479 FLAG_plot_incoming_sequence_number_delta = setting;
terelius2ee076d2017-08-15 02:04:02 -0700480 FLAG_plot_incoming_delay = setting;
481 FLAG_plot_incoming_loss_rate = setting;
482 FLAG_plot_incoming_bitrate = setting;
483 FLAG_plot_outgoing_bitrate = setting;
484 FLAG_plot_incoming_stream_bitrate = setting;
485 FLAG_plot_outgoing_stream_bitrate = setting;
Bjorn Terelius28db2662017-10-04 14:22:43 +0200486 FLAG_plot_simulated_receiveside_bwe = setting;
terelius2ee076d2017-08-15 02:04:02 -0700487 FLAG_plot_simulated_sendside_bwe = setting;
488 FLAG_plot_network_delay_feedback = setting;
489 FLAG_plot_fraction_loss_feedback = setting;
490 FLAG_plot_timestamps = setting;
Bjorn Tereliusb1222c22018-07-24 13:45:31 +0200491 FLAG_plot_rtcp_details = setting;
terelius2ee076d2017-08-15 02:04:02 -0700492 FLAG_plot_audio_encoder_bitrate_bps = setting;
493 FLAG_plot_audio_encoder_frame_length_ms = setting;
494 FLAG_plot_audio_encoder_packet_loss = setting;
495 FLAG_plot_audio_encoder_fec = setting;
496 FLAG_plot_audio_encoder_dtx = setting;
497 FLAG_plot_audio_encoder_num_channels = setting;
Minyue Li27e2b7d2018-05-07 15:20:24 +0200498 FLAG_plot_neteq_stats = setting;
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800499 FLAG_plot_ice_candidate_pair_config = setting;
500 FLAG_plot_ice_connectivity_check = setting;
terelius2ee076d2017-08-15 02:04:02 -0700501}