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