terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 11 | #include <stdio.h> |
| 12 | #include <string.h> |
Jonas Olsson | 5b2eda4 | 2019-06-11 14:29:40 +0200 | [diff] [blame] | 13 | |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 14 | #include <iostream> |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 15 | #include <map> |
| 16 | #include <memory> |
| 17 | #include <string> |
| 18 | #include <utility> |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 19 | #include <vector> |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 20 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 21 | #include "absl/algorithm/container.h" |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 22 | #include "absl/flags/flag.h" |
| 23 | #include "absl/flags/parse.h" |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 24 | #include "absl/flags/usage.h" |
| 25 | #include "absl/flags/usage_config.h" |
| 26 | #include "absl/strings/match.h" |
Ivo Creusen | 3ce44a3 | 2019-10-31 14:38:11 +0100 | [diff] [blame] | 27 | #include "api/neteq/neteq.h" |
Danil Chapovalov | 83bbe91 | 2019-08-07 12:24:53 +0200 | [diff] [blame] | 28 | #include "api/rtc_event_log/rtc_event_log.h" |
Sebastian Jansson | b290a6d | 2019-01-03 14:46:23 +0100 | [diff] [blame] | 29 | #include "logging/rtc_event_log/rtc_event_log_parser.h" |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 30 | #include "modules/rtp_rtcp/source/rtcp_packet/report_block.h" |
| 31 | #include "rtc_base/checks.h" |
Björn Terelius | a06048a | 2019-11-01 14:31:46 +0100 | [diff] [blame] | 32 | #include "rtc_base/logging.h" |
Bjorn Terelius | 48b8279 | 2020-05-19 10:57:24 +0200 | [diff] [blame] | 33 | #include "rtc_tools/rtc_event_log_visualizer/alerts.h" |
Mirko Bonadei | 575998c | 2019-07-25 13:57:41 +0200 | [diff] [blame] | 34 | #include "rtc_tools/rtc_event_log_visualizer/analyzer.h" |
| 35 | #include "rtc_tools/rtc_event_log_visualizer/plot_base.h" |
| 36 | #include "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h" |
| 37 | #include "rtc_tools/rtc_event_log_visualizer/plot_python.h" |
Mirko Bonadei | 17f4878 | 2018-09-28 08:51:10 +0200 | [diff] [blame] | 38 | #include "system_wrappers/include/field_trial.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 39 | #include "test/field_trial.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 40 | #include "test/testsupport/file_utils.h" |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 41 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 42 | ABSL_FLAG(std::string, |
| 43 | plot, |
| 44 | "default", |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 45 | "A comma separated list of plot names. See --list_plots for valid " |
| 46 | "options."); |
Bjorn Terelius | 1edfff9 | 2017-10-11 13:15:19 +0200 | [diff] [blame] | 47 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 48 | ABSL_FLAG( |
| 49 | std::string, |
stefan | 985d280 | 2016-11-15 06:54:09 -0800 | [diff] [blame] | 50 | force_fieldtrials, |
| 51 | "", |
| 52 | "Field trials control experimental feature code which can be forced. " |
| 53 | "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/" |
| 54 | " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple " |
| 55 | "trials are separated by \"/\""); |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 56 | ABSL_FLAG(std::string, |
| 57 | wav_filename, |
| 58 | "", |
| 59 | "Path to wav file used for simulation of jitter buffer"); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 60 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 61 | ABSL_FLAG(bool, |
| 62 | show_detector_state, |
| 63 | false, |
| 64 | "Show the state of the delay based BWE detector on the total " |
| 65 | "bitrate graph"); |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 66 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 67 | ABSL_FLAG(bool, |
| 68 | show_alr_state, |
| 69 | false, |
| 70 | "Show the state ALR state on the total bitrate graph"); |
Ilya Nikolaevskiy | a4259f6 | 2017-12-05 13:19:45 +0100 | [diff] [blame] | 71 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 72 | ABSL_FLAG(bool, |
| 73 | parse_unconfigured_header_extensions, |
| 74 | true, |
| 75 | "Attempt to parse unconfigured header extensions using the default " |
| 76 | "WebRTC mapping. This can give very misleading results if the " |
| 77 | "application negotiates a different mapping."); |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 78 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 79 | ABSL_FLAG(bool, |
| 80 | print_triage_alerts, |
| 81 | false, |
| 82 | "Print triage alerts, i.e. a list of potential problems."); |
Bjorn Terelius | 2eb3188 | 2017-11-30 15:15:25 +0100 | [diff] [blame] | 83 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 84 | ABSL_FLAG(bool, |
| 85 | normalize_time, |
| 86 | true, |
| 87 | "Normalize the log timestamps so that the call starts at time 0."); |
Stefan Holmer | 1d4a227 | 2018-05-24 13:48:09 +0200 | [diff] [blame] | 88 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 89 | ABSL_FLAG(bool, |
| 90 | shared_xaxis, |
| 91 | false, |
| 92 | "Share x-axis between all plots so that zooming in one plot " |
| 93 | "updates all the others too. A downside is that certain " |
| 94 | "operations like panning become much slower."); |
Bjorn Terelius | ff8cce3 | 2019-04-11 18:34:01 +0200 | [diff] [blame] | 95 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 96 | ABSL_FLAG(bool, |
| 97 | protobuf_output, |
| 98 | false, |
| 99 | "Output charts as protobuf instead of python code."); |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 100 | |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 101 | ABSL_FLAG(bool, |
| 102 | list_plots, |
| 103 | false, |
| 104 | "List of registered plots (for use with the --plot flag)"); |
| 105 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 106 | using webrtc::Plot; |
| 107 | |
| 108 | namespace { |
| 109 | std::vector<std::string> StrSplit(const std::string& s, |
| 110 | const std::string& delimiter) { |
| 111 | std::vector<std::string> v; |
| 112 | size_t pos = 0; |
| 113 | while (pos < s.length()) { |
| 114 | const std::string token = s.substr(pos, s.find(delimiter, pos) - pos); |
| 115 | pos += token.length() + delimiter.length(); |
| 116 | v.push_back(token); |
| 117 | } |
| 118 | return v; |
| 119 | } |
| 120 | |
| 121 | struct PlotDeclaration { |
| 122 | PlotDeclaration(const std::string& label, std::function<void(Plot*)> f) |
| 123 | : label(label), enabled(false), plot_func(f) {} |
| 124 | const std::string label; |
| 125 | bool enabled; |
| 126 | // TODO(terelius): Add a help text/explanation. |
| 127 | const std::function<void(Plot*)> plot_func; |
| 128 | }; |
| 129 | |
| 130 | class PlotMap { |
| 131 | public: |
| 132 | void RegisterPlot(const std::string& label, std::function<void(Plot*)> f) { |
| 133 | for (const auto& plot : plots_) { |
| 134 | RTC_DCHECK(plot.label != label) |
| 135 | << "Can't use the same label for multiple plots"; |
| 136 | } |
| 137 | plots_.push_back({label, f}); |
| 138 | } |
| 139 | |
| 140 | bool EnablePlotsByFlags( |
| 141 | const std::vector<std::string>& flags, |
| 142 | const std::map<std::string, std::vector<std::string>>& flag_aliases) { |
| 143 | bool status = true; |
| 144 | for (const std::string& flag : flags) { |
| 145 | auto alias_it = flag_aliases.find(flag); |
| 146 | if (alias_it != flag_aliases.end()) { |
| 147 | const auto& replacements = alias_it->second; |
| 148 | for (const auto& replacement : replacements) { |
| 149 | status &= EnablePlotByFlag(replacement); |
| 150 | } |
| 151 | } else { |
| 152 | status &= EnablePlotByFlag(flag); |
| 153 | } |
| 154 | } |
| 155 | return status; |
| 156 | } |
| 157 | |
| 158 | void EnableAllPlots() { |
| 159 | for (auto& plot : plots_) { |
| 160 | plot.enabled = true; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | std::vector<PlotDeclaration>::iterator begin() { return plots_.begin(); } |
| 165 | std::vector<PlotDeclaration>::iterator end() { return plots_.end(); } |
| 166 | |
| 167 | private: |
| 168 | bool EnablePlotByFlag(const std::string& flag) { |
| 169 | for (auto& plot : plots_) { |
| 170 | if (plot.label == flag) { |
| 171 | plot.enabled = true; |
| 172 | return true; |
| 173 | } |
| 174 | } |
| 175 | if (flag == "simulated_neteq_jitter_buffer_delay") { |
| 176 | // This flag is handled separately. |
| 177 | return true; |
| 178 | } |
| 179 | std::cerr << "Unrecognized plot name \'" << flag << "\'. Aborting." |
| 180 | << std::endl; |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | std::vector<PlotDeclaration> plots_; |
| 185 | }; |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 186 | |
| 187 | bool ContainsHelppackageFlags(absl::string_view filename) { |
| 188 | return absl::EndsWith(filename, "main.cc"); |
| 189 | } |
| 190 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 191 | } // namespace |
terelius | 2ee076d | 2017-08-15 02:04:02 -0700 | [diff] [blame] | 192 | |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 193 | int main(int argc, char* argv[]) { |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 194 | absl::SetProgramUsageMessage( |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 195 | "A tool for visualizing WebRTC event logs.\n" |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 196 | "Example usage:\n" |
| 197 | "./event_log_visualizer <logfile> | python\n"); |
Bjorn Terelius | 48b8279 | 2020-05-19 10:57:24 +0200 | [diff] [blame] | 198 | absl::FlagsUsageConfig flag_config; |
| 199 | flag_config.contains_help_flags = &ContainsHelppackageFlags; |
| 200 | absl::SetFlagsUsageConfig(flag_config); |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 201 | std::vector<char*> args = absl::ParseCommandLine(argc, argv); |
| 202 | |
Björn Terelius | a06048a | 2019-11-01 14:31:46 +0100 | [diff] [blame] | 203 | // Print RTC_LOG warnings and errors even in release builds. |
| 204 | if (rtc::LogMessage::GetLogToDebug() > rtc::LS_WARNING) { |
| 205 | rtc::LogMessage::LogToDebug(rtc::LS_WARNING); |
| 206 | } |
| 207 | rtc::LogMessage::SetLogToStderr(true); |
| 208 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 209 | // Flag replacements |
| 210 | std::map<std::string, std::vector<std::string>> flag_aliases = { |
| 211 | {"default", |
| 212 | {"incoming_delay", "incoming_loss_rate", "incoming_bitrate", |
Bjorn Terelius | 873a7a9 | 2019-06-13 16:01:17 +0200 | [diff] [blame] | 213 | "outgoing_bitrate", "incoming_stream_bitrate", |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 214 | "outgoing_stream_bitrate", "network_delay_feedback", |
| 215 | "fraction_loss_feedback"}}, |
| 216 | {"sendside_bwe", |
| 217 | {"outgoing_packet_sizes", "outgoing_bitrate", "outgoing_stream_bitrate", |
| 218 | "simulated_sendside_bwe", "network_delay_feedback", |
| 219 | "fraction_loss_feedback"}}, |
| 220 | {"receiveside_bwe", |
| 221 | {"incoming_packet_sizes", "incoming_delay", "incoming_loss_rate", |
Bjorn Terelius | 873a7a9 | 2019-06-13 16:01:17 +0200 | [diff] [blame] | 222 | "incoming_bitrate", "incoming_stream_bitrate", |
| 223 | "simulated_receiveside_bwe"}}, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 224 | {"rtcp_details", |
| 225 | {"incoming_rtcp_fraction_lost", "outgoing_rtcp_fraction_lost", |
Bjorn Terelius | 873a7a9 | 2019-06-13 16:01:17 +0200 | [diff] [blame] | 226 | "incoming_rtcp_cumulative_lost", "outgoing_rtcp_cumulative_lost", |
| 227 | "incoming_rtcp_highest_seq_number", "outgoing_rtcp_highest_seq_number", |
| 228 | "incoming_rtcp_delay_since_last_sr", |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 229 | "outgoing_rtcp_delay_since_last_sr"}}, |
| 230 | {"simulated_neteq_stats", |
| 231 | {"simulated_neteq_jitter_buffer_delay", |
Bjorn Terelius | 873a7a9 | 2019-06-13 16:01:17 +0200 | [diff] [blame] | 232 | "simulated_neteq_preferred_buffer_size", |
| 233 | "simulated_neteq_concealment_events", |
| 234 | "simulated_neteq_packet_loss_rate", "simulated_neteq_preemptive_rate", |
| 235 | "simulated_neteq_accelerate_rate", "simulated_neteq_speech_expand_rate", |
| 236 | "simulated_neteq_expand_rate"}}}; |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 237 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 238 | std::vector<std::string> plot_flags = |
| 239 | StrSplit(absl::GetFlag(FLAGS_plot), ","); |
kjellander | 4fa5be4 | 2017-05-16 00:01:23 -0700 | [diff] [blame] | 240 | |
Bjorn Terelius | edab301 | 2018-01-31 17:23:40 +0100 | [diff] [blame] | 241 | // InitFieldTrialsFromString stores the char*, so the char array must outlive |
| 242 | // the application. |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 243 | const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials); |
| 244 | webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str()); |
stefan | 985d280 | 2016-11-15 06:54:09 -0800 | [diff] [blame] | 245 | |
Sebastian Jansson | b290a6d | 2019-01-03 14:46:23 +0100 | [diff] [blame] | 246 | webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions header_extensions = |
| 247 | webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions::kDontParse; |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 248 | if (absl::GetFlag(FLAGS_parse_unconfigured_header_extensions)) { |
Sebastian Jansson | b290a6d | 2019-01-03 14:46:23 +0100 | [diff] [blame] | 249 | header_extensions = webrtc::ParsedRtcEventLog:: |
Bjorn Terelius | c4ca1d3 | 2018-04-27 14:33:34 +0200 | [diff] [blame] | 250 | UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig; |
| 251 | } |
Björn Terelius | a06048a | 2019-11-01 14:31:46 +0100 | [diff] [blame] | 252 | webrtc::ParsedRtcEventLog parsed_log(header_extensions, |
| 253 | /*allow_incomplete_logs*/ true); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 254 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 255 | if (args.size() == 2) { |
| 256 | std::string filename = args[1]; |
Björn Terelius | a06048a | 2019-11-01 14:31:46 +0100 | [diff] [blame] | 257 | auto status = parsed_log.ParseFile(filename); |
| 258 | if (!status.ok()) { |
| 259 | std::cerr << "Failed to parse " << filename << ": " << status.message() |
| 260 | << std::endl; |
| 261 | return -1; |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 262 | } |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 263 | } |
| 264 | |
Bjorn Terelius | 48b8279 | 2020-05-19 10:57:24 +0200 | [diff] [blame] | 265 | webrtc::AnalyzerConfig config; |
| 266 | config.window_duration_ = 250000; |
| 267 | config.step_ = 10000; |
| 268 | config.normalize_time_ = absl::GetFlag(FLAGS_normalize_time); |
| 269 | config.begin_time_ = parsed_log.first_timestamp(); |
| 270 | config.end_time_ = parsed_log.last_timestamp(); |
| 271 | if (config.end_time_ < config.begin_time_) { |
| 272 | RTC_LOG(LS_WARNING) << "Log end time " << config.end_time_ |
| 273 | << " not after begin time " << config.begin_time_ |
| 274 | << ". Nothing to analyze. Is the log broken?"; |
| 275 | return -1; |
| 276 | } |
| 277 | |
| 278 | webrtc::EventLogAnalyzer analyzer(parsed_log, config); |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 279 | std::unique_ptr<webrtc::PlotCollection> collection; |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 280 | if (absl::GetFlag(FLAGS_protobuf_output)) { |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 281 | collection.reset(new webrtc::ProtobufPlotCollection()); |
| 282 | } else { |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 283 | collection.reset( |
| 284 | new webrtc::PythonPlotCollection(absl::GetFlag(FLAGS_shared_xaxis))); |
Bjorn Terelius | ef73f59 | 2018-09-10 20:11:49 +0200 | [diff] [blame] | 285 | } |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 286 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 287 | PlotMap plots; |
| 288 | plots.RegisterPlot("incoming_packet_sizes", [&](Plot* plot) { |
| 289 | analyzer.CreatePacketGraph(webrtc::kIncomingPacket, plot); |
| 290 | }); |
| 291 | |
| 292 | plots.RegisterPlot("outgoing_packet_sizes", [&](Plot* plot) { |
| 293 | analyzer.CreatePacketGraph(webrtc::kOutgoingPacket, plot); |
| 294 | }); |
| 295 | plots.RegisterPlot("incoming_rtcp_types", [&](Plot* plot) { |
| 296 | analyzer.CreateRtcpTypeGraph(webrtc::kIncomingPacket, plot); |
| 297 | }); |
| 298 | plots.RegisterPlot("outgoing_rtcp_types", [&](Plot* plot) { |
| 299 | analyzer.CreateRtcpTypeGraph(webrtc::kOutgoingPacket, plot); |
| 300 | }); |
| 301 | plots.RegisterPlot("incoming_packet_count", [&](Plot* plot) { |
| 302 | analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket, plot); |
| 303 | }); |
| 304 | plots.RegisterPlot("outgoing_packet_count", [&](Plot* plot) { |
| 305 | analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket, plot); |
| 306 | }); |
Kristoffer Erlandsson | 283c106 | 2020-03-30 13:01:37 +0200 | [diff] [blame] | 307 | plots.RegisterPlot("incoming_packet_rate", [&](Plot* plot) { |
| 308 | analyzer.CreatePacketRateGraph(webrtc::kIncomingPacket, plot); |
| 309 | }); |
| 310 | plots.RegisterPlot("outgoing_packet_rate", [&](Plot* plot) { |
| 311 | analyzer.CreatePacketRateGraph(webrtc::kOutgoingPacket, plot); |
| 312 | }); |
Kristoffer Erlandsson | a2ce423 | 2020-04-01 14:33:30 +0200 | [diff] [blame] | 313 | plots.RegisterPlot("total_incoming_packet_rate", [&](Plot* plot) { |
| 314 | analyzer.CreateTotalPacketRateGraph(webrtc::kIncomingPacket, plot); |
| 315 | }); |
| 316 | plots.RegisterPlot("total_outgoing_packet_rate", [&](Plot* plot) { |
| 317 | analyzer.CreateTotalPacketRateGraph(webrtc::kOutgoingPacket, plot); |
| 318 | }); |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 319 | plots.RegisterPlot("audio_playout", |
| 320 | [&](Plot* plot) { analyzer.CreatePlayoutGraph(plot); }); |
| 321 | plots.RegisterPlot("incoming_audio_level", [&](Plot* plot) { |
| 322 | analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket, plot); |
| 323 | }); |
| 324 | plots.RegisterPlot("outgoing_audio_level", [&](Plot* plot) { |
| 325 | analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket, plot); |
| 326 | }); |
| 327 | plots.RegisterPlot("incoming_sequence_number_delta", [&](Plot* plot) { |
| 328 | analyzer.CreateSequenceNumberGraph(plot); |
| 329 | }); |
| 330 | plots.RegisterPlot("incoming_delay", [&](Plot* plot) { |
| 331 | analyzer.CreateIncomingDelayGraph(plot); |
| 332 | }); |
| 333 | plots.RegisterPlot("incoming_loss_rate", [&](Plot* plot) { |
| 334 | analyzer.CreateIncomingPacketLossGraph(plot); |
| 335 | }); |
| 336 | plots.RegisterPlot("incoming_bitrate", [&](Plot* plot) { |
| 337 | analyzer.CreateTotalIncomingBitrateGraph(plot); |
| 338 | }); |
| 339 | plots.RegisterPlot("outgoing_bitrate", [&](Plot* plot) { |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 340 | analyzer.CreateTotalOutgoingBitrateGraph( |
| 341 | plot, absl::GetFlag(FLAGS_show_detector_state), |
| 342 | absl::GetFlag(FLAGS_show_alr_state)); |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 343 | }); |
| 344 | plots.RegisterPlot("incoming_stream_bitrate", [&](Plot* plot) { |
| 345 | analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket, plot); |
| 346 | }); |
| 347 | plots.RegisterPlot("outgoing_stream_bitrate", [&](Plot* plot) { |
| 348 | analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket, plot); |
| 349 | }); |
| 350 | plots.RegisterPlot("incoming_layer_bitrate_allocation", [&](Plot* plot) { |
| 351 | analyzer.CreateBitrateAllocationGraph(webrtc::kIncomingPacket, plot); |
| 352 | }); |
| 353 | plots.RegisterPlot("outgoing_layer_bitrate_allocation", [&](Plot* plot) { |
| 354 | analyzer.CreateBitrateAllocationGraph(webrtc::kOutgoingPacket, plot); |
| 355 | }); |
| 356 | plots.RegisterPlot("simulated_receiveside_bwe", [&](Plot* plot) { |
| 357 | analyzer.CreateReceiveSideBweSimulationGraph(plot); |
| 358 | }); |
| 359 | plots.RegisterPlot("simulated_sendside_bwe", [&](Plot* plot) { |
| 360 | analyzer.CreateSendSideBweSimulationGraph(plot); |
| 361 | }); |
| 362 | plots.RegisterPlot("simulated_goog_cc", [&](Plot* plot) { |
| 363 | analyzer.CreateGoogCcSimulationGraph(plot); |
| 364 | }); |
| 365 | plots.RegisterPlot("network_delay_feedback", [&](Plot* plot) { |
| 366 | analyzer.CreateNetworkDelayFeedbackGraph(plot); |
| 367 | }); |
| 368 | plots.RegisterPlot("fraction_loss_feedback", [&](Plot* plot) { |
| 369 | analyzer.CreateFractionLossGraph(plot); |
| 370 | }); |
| 371 | plots.RegisterPlot("incoming_timestamps", [&](Plot* plot) { |
| 372 | analyzer.CreateTimestampGraph(webrtc::kIncomingPacket, plot); |
| 373 | }); |
| 374 | plots.RegisterPlot("outgoing_timestamps", [&](Plot* plot) { |
| 375 | analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket, plot); |
| 376 | }); |
| 377 | |
| 378 | auto GetFractionLost = [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 379 | return static_cast<double>(block.fraction_lost()) / 256 * 100; |
| 380 | }; |
| 381 | plots.RegisterPlot("incoming_rtcp_fraction_lost", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 382 | analyzer.CreateSenderAndReceiverReportPlot( |
| 383 | webrtc::kIncomingPacket, GetFractionLost, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 384 | "Fraction lost (incoming RTCP)", "Loss rate (percent)", plot); |
| 385 | }); |
| 386 | plots.RegisterPlot("outgoing_rtcp_fraction_lost", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 387 | analyzer.CreateSenderAndReceiverReportPlot( |
| 388 | webrtc::kOutgoingPacket, GetFractionLost, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 389 | "Fraction lost (outgoing RTCP)", "Loss rate (percent)", plot); |
| 390 | }); |
| 391 | auto GetCumulativeLost = [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 392 | return block.cumulative_lost_signed(); |
| 393 | }; |
| 394 | plots.RegisterPlot("incoming_rtcp_cumulative_lost", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 395 | analyzer.CreateSenderAndReceiverReportPlot( |
| 396 | webrtc::kIncomingPacket, GetCumulativeLost, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 397 | "Cumulative lost packets (incoming RTCP)", "Packets", plot); |
| 398 | }); |
| 399 | plots.RegisterPlot("outgoing_rtcp_cumulative_lost", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 400 | analyzer.CreateSenderAndReceiverReportPlot( |
| 401 | webrtc::kOutgoingPacket, GetCumulativeLost, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 402 | "Cumulative lost packets (outgoing RTCP)", "Packets", plot); |
| 403 | }); |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 404 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 405 | auto GetHighestSeqNumber = |
| 406 | [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 407 | return block.extended_high_seq_num(); |
| 408 | }; |
| 409 | plots.RegisterPlot("incoming_rtcp_highest_seq_number", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 410 | analyzer.CreateSenderAndReceiverReportPlot( |
| 411 | webrtc::kIncomingPacket, GetHighestSeqNumber, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 412 | "Highest sequence number (incoming RTCP)", "Sequence number", plot); |
| 413 | }); |
| 414 | plots.RegisterPlot("outgoing_rtcp_highest_seq_number", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 415 | analyzer.CreateSenderAndReceiverReportPlot( |
| 416 | webrtc::kOutgoingPacket, GetHighestSeqNumber, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 417 | "Highest sequence number (outgoing RTCP)", "Sequence number", plot); |
| 418 | }); |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 419 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 420 | auto DelaySinceLastSr = [](const webrtc::rtcp::ReportBlock& block) -> float { |
| 421 | return static_cast<double>(block.delay_since_last_sr()) / 65536; |
| 422 | }; |
| 423 | plots.RegisterPlot("incoming_rtcp_delay_since_last_sr", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 424 | analyzer.CreateSenderAndReceiverReportPlot( |
| 425 | webrtc::kIncomingPacket, DelaySinceLastSr, |
| 426 | "Delay since last received sender report (incoming RTCP)", "Time (s)", |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 427 | plot); |
| 428 | }); |
| 429 | plots.RegisterPlot("outgoing_rtcp_delay_since_last_sr", [&](Plot* plot) { |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 430 | analyzer.CreateSenderAndReceiverReportPlot( |
| 431 | webrtc::kOutgoingPacket, DelaySinceLastSr, |
| 432 | "Delay since last received sender report (outgoing RTCP)", "Time (s)", |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 433 | plot); |
| 434 | }); |
Bjorn Terelius | b1222c2 | 2018-07-24 13:45:31 +0200 | [diff] [blame] | 435 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 436 | plots.RegisterPlot("pacer_delay", |
| 437 | [&](Plot* plot) { analyzer.CreatePacerDelayGraph(plot); }); |
| 438 | plots.RegisterPlot("audio_encoder_bitrate", [&](Plot* plot) { |
| 439 | analyzer.CreateAudioEncoderTargetBitrateGraph(plot); |
| 440 | }); |
| 441 | plots.RegisterPlot("audio_encoder_frame_length", [&](Plot* plot) { |
| 442 | analyzer.CreateAudioEncoderFrameLengthGraph(plot); |
| 443 | }); |
| 444 | plots.RegisterPlot("audio_encoder_packet_loss", [&](Plot* plot) { |
| 445 | analyzer.CreateAudioEncoderPacketLossGraph(plot); |
| 446 | }); |
| 447 | plots.RegisterPlot("audio_encoder_fec", [&](Plot* plot) { |
| 448 | analyzer.CreateAudioEncoderEnableFecGraph(plot); |
| 449 | }); |
| 450 | plots.RegisterPlot("audio_encoder_dtx", [&](Plot* plot) { |
| 451 | analyzer.CreateAudioEncoderEnableDtxGraph(plot); |
| 452 | }); |
| 453 | plots.RegisterPlot("audio_encoder_num_channels", [&](Plot* plot) { |
| 454 | analyzer.CreateAudioEncoderNumChannelsGraph(plot); |
| 455 | }); |
| 456 | |
| 457 | plots.RegisterPlot("ice_candidate_pair_config", [&](Plot* plot) { |
| 458 | analyzer.CreateIceCandidatePairConfigGraph(plot); |
| 459 | }); |
| 460 | plots.RegisterPlot("ice_connectivity_check", [&](Plot* plot) { |
| 461 | analyzer.CreateIceConnectivityCheckGraph(plot); |
| 462 | }); |
| 463 | plots.RegisterPlot("dtls_transport_state", [&](Plot* plot) { |
| 464 | analyzer.CreateDtlsTransportStateGraph(plot); |
| 465 | }); |
| 466 | plots.RegisterPlot("dtls_writable_state", [&](Plot* plot) { |
| 467 | analyzer.CreateDtlsWritableStateGraph(plot); |
| 468 | }); |
| 469 | |
| 470 | std::string wav_path; |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 471 | if (!absl::GetFlag(FLAGS_wav_filename).empty()) { |
| 472 | wav_path = absl::GetFlag(FLAGS_wav_filename); |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 473 | } else { |
| 474 | wav_path = webrtc::test::ResourcePath( |
| 475 | "audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav"); |
Bjorn Terelius | 0295a96 | 2017-10-25 17:42:41 +0200 | [diff] [blame] | 476 | } |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 477 | absl::optional<webrtc::EventLogAnalyzer::NetEqStatsGetterMap> neteq_stats; |
| 478 | |
| 479 | plots.RegisterPlot("simulated_neteq_expand_rate", [&](Plot* plot) { |
| 480 | if (!neteq_stats) { |
| 481 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
Minyue Li | 45fc6df | 2018-06-21 11:47:14 +0200 | [diff] [blame] | 482 | } |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 483 | analyzer.CreateNetEqNetworkStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 484 | *neteq_stats, |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 485 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 486 | return stats.expand_rate / 16384.f; |
| 487 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 488 | "Expand rate", plot); |
| 489 | }); |
| 490 | |
| 491 | plots.RegisterPlot("simulated_neteq_speech_expand_rate", [&](Plot* plot) { |
| 492 | if (!neteq_stats) { |
| 493 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 494 | } |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 495 | analyzer.CreateNetEqNetworkStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 496 | *neteq_stats, |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 497 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 498 | return stats.speech_expand_rate / 16384.f; |
| 499 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 500 | "Speech expand rate", plot); |
| 501 | }); |
| 502 | |
| 503 | plots.RegisterPlot("simulated_neteq_accelerate_rate", [&](Plot* plot) { |
| 504 | if (!neteq_stats) { |
| 505 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 506 | } |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 507 | analyzer.CreateNetEqNetworkStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 508 | *neteq_stats, |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 509 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 510 | return stats.accelerate_rate / 16384.f; |
| 511 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 512 | "Accelerate rate", plot); |
| 513 | }); |
| 514 | |
| 515 | plots.RegisterPlot("simulated_neteq_preemptive_rate", [&](Plot* plot) { |
| 516 | if (!neteq_stats) { |
| 517 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 518 | } |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 519 | analyzer.CreateNetEqNetworkStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 520 | *neteq_stats, |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 521 | [](const webrtc::NetEqNetworkStatistics& stats) { |
Jakob Ivarsson | 21f6fd7 | 2019-04-04 10:15:02 +0200 | [diff] [blame] | 522 | return stats.preemptive_rate / 16384.f; |
| 523 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 524 | "Preemptive rate", plot); |
| 525 | }); |
| 526 | |
| 527 | plots.RegisterPlot("simulated_neteq_packet_loss_rate", [&](Plot* plot) { |
| 528 | if (!neteq_stats) { |
| 529 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 530 | } |
Jakob Ivarsson | 21f6fd7 | 2019-04-04 10:15:02 +0200 | [diff] [blame] | 531 | analyzer.CreateNetEqNetworkStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 532 | *neteq_stats, |
Jakob Ivarsson | 21f6fd7 | 2019-04-04 10:15:02 +0200 | [diff] [blame] | 533 | [](const webrtc::NetEqNetworkStatistics& stats) { |
Minyue Li | 27e2b7d | 2018-05-07 15:20:24 +0200 | [diff] [blame] | 534 | return stats.packet_loss_rate / 16384.f; |
| 535 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 536 | "Packet loss rate", plot); |
| 537 | }); |
| 538 | |
| 539 | plots.RegisterPlot("simulated_neteq_concealment_events", [&](Plot* plot) { |
| 540 | if (!neteq_stats) { |
| 541 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 542 | } |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 543 | analyzer.CreateNetEqLifetimeStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 544 | *neteq_stats, |
Minyue Li | c9ac93f | 2018-06-26 13:01:32 +0200 | [diff] [blame] | 545 | [](const webrtc::NetEqLifetimeStatistics& stats) { |
| 546 | return static_cast<float>(stats.concealment_events); |
| 547 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 548 | "Concealment events", plot); |
| 549 | }); |
| 550 | |
| 551 | plots.RegisterPlot("simulated_neteq_preferred_buffer_size", [&](Plot* plot) { |
| 552 | if (!neteq_stats) { |
| 553 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 554 | } |
Jakob Ivarsson | 21f6fd7 | 2019-04-04 10:15:02 +0200 | [diff] [blame] | 555 | analyzer.CreateNetEqNetworkStatsGraph( |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 556 | *neteq_stats, |
Jakob Ivarsson | 21f6fd7 | 2019-04-04 10:15:02 +0200 | [diff] [blame] | 557 | [](const webrtc::NetEqNetworkStatistics& stats) { |
| 558 | return stats.preferred_buffer_size_ms; |
| 559 | }, |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 560 | "Preferred buffer size (ms)", plot); |
| 561 | }); |
| 562 | |
| 563 | if (absl::c_find(plot_flags, "all") != plot_flags.end()) { |
| 564 | plots.EnableAllPlots(); |
| 565 | // Treated separately since it isn't registered like the other plots. |
| 566 | plot_flags.push_back("simulated_neteq_jitter_buffer_delay"); |
| 567 | } else { |
| 568 | bool success = plots.EnablePlotsByFlags(plot_flags, flag_aliases); |
| 569 | if (!success) { |
| 570 | return 1; |
| 571 | } |
henrik.lundin | 3c938fc | 2017-06-14 06:09:58 -0700 | [diff] [blame] | 572 | } |
| 573 | |
Mirko Bonadei | f2d97b8 | 2019-07-24 15:29:47 +0200 | [diff] [blame] | 574 | if (absl::GetFlag(FLAGS_list_plots)) { |
| 575 | std::cerr << "List of registered plots (for use with the --plot flag):" |
| 576 | << std::endl; |
| 577 | for (const auto& plot : plots) { |
| 578 | // TODO(terelius): Also print a help text. |
| 579 | std::cerr << " " << plot.label << std::endl; |
| 580 | } |
| 581 | // The following flag doesn't fit the model used for the other plots. |
| 582 | std::cerr << "simulated_neteq_jitter_buffer_delay" << std::endl; |
| 583 | std::cerr << "List of plot aliases (for use with the --plot flag):" |
| 584 | << std::endl; |
| 585 | std::cerr << " all = every registered plot" << std::endl; |
| 586 | for (const auto& alias : flag_aliases) { |
| 587 | std::cerr << " " << alias.first << " = "; |
| 588 | for (const auto& replacement : alias.second) { |
| 589 | std::cerr << replacement << ","; |
| 590 | } |
| 591 | std::cerr << std::endl; |
| 592 | } |
| 593 | return 0; |
| 594 | } |
| 595 | if (args.size() != 2) { |
| 596 | // Print usage information. |
| 597 | std::cerr << absl::ProgramUsageMessage(); |
| 598 | return 1; |
| 599 | } |
Qingsi Wang | 8eca1ff | 2018-02-02 11:49:44 -0800 | [diff] [blame] | 600 | |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 601 | for (const auto& plot : plots) { |
| 602 | if (plot.enabled) { |
| 603 | Plot* output = collection->AppendNewPlot(); |
| 604 | plot.plot_func(output); |
| 605 | output->SetId(plot.label); |
| 606 | } |
Zach Stein | 10a5801 | 2018-12-07 12:26:28 -0800 | [diff] [blame] | 607 | } |
Bjorn Terelius | 1aa9ee9 | 2019-06-11 17:39:38 +0200 | [diff] [blame] | 608 | |
| 609 | // The model we use for registering plots assumes that the each plot label |
| 610 | // can be mapped to a lambda that will produce exactly one plot. The |
| 611 | // simulated_neteq_jitter_buffer_delay plot doesn't fit this model since it |
| 612 | // creates multiple plots, and would need some state kept between the lambda |
| 613 | // calls. |
| 614 | if (absl::c_find(plot_flags, "simulated_neteq_jitter_buffer_delay") != |
| 615 | plot_flags.end()) { |
| 616 | if (!neteq_stats) { |
| 617 | neteq_stats = analyzer.SimulateNetEq(wav_path, 48000); |
| 618 | } |
| 619 | for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it = |
| 620 | neteq_stats->cbegin(); |
| 621 | it != neteq_stats->cend(); ++it) { |
| 622 | analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(), |
| 623 | collection->AppendNewPlot()); |
| 624 | } |
Zach Stein | 10a5801 | 2018-12-07 12:26:28 -0800 | [diff] [blame] | 625 | } |
| 626 | |
terelius | dc35dcd | 2016-08-01 12:03:27 -0700 | [diff] [blame] | 627 | collection->Draw(); |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 628 | |
Mirko Bonadei | 4b091f4 | 2019-07-16 11:55:08 +0200 | [diff] [blame] | 629 | if (absl::GetFlag(FLAGS_print_triage_alerts)) { |
Bjorn Terelius | 48b8279 | 2020-05-19 10:57:24 +0200 | [diff] [blame] | 630 | webrtc::TriageHelper triage_alerts(config); |
| 631 | triage_alerts.AnalyzeLog(parsed_log); |
| 632 | triage_alerts.Print(stderr); |
Bjorn Terelius | 2eb3188 | 2017-11-30 15:15:25 +0100 | [diff] [blame] | 633 | } |
| 634 | |
terelius | 54ce680 | 2016-07-13 06:44:41 -0700 | [diff] [blame] | 635 | return 0; |
| 636 | } |