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