| OLD | NEW |
| (Empty) |
| 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 | |
| 11 #include <iostream> | |
| 12 | |
| 13 #include "webrtc/base/flags.h" | |
| 14 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" | |
| 15 #include "webrtc/test/field_trial.h" | |
| 16 #include "webrtc/test/testsupport/fileutils.h" | |
| 17 #include "webrtc/tools/event_log_visualizer/analyzer.h" | |
| 18 #include "webrtc/tools/event_log_visualizer/plot_base.h" | |
| 19 #include "webrtc/tools/event_log_visualizer/plot_python.h" | |
| 20 | |
| 21 DEFINE_bool(incoming, true, "Plot statistics for incoming packets."); | |
| 22 DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets."); | |
| 23 DEFINE_bool(plot_all, true, "Plot all different data types."); | |
| 24 DEFINE_bool(plot_packets, | |
| 25 false, | |
| 26 "Plot bar graph showing the size of each packet."); | |
| 27 DEFINE_bool(plot_audio_playout, | |
| 28 false, | |
| 29 "Plot bar graph showing the time between each audio playout."); | |
| 30 DEFINE_bool(plot_audio_level, | |
| 31 false, | |
| 32 "Plot line graph showing the audio level."); | |
| 33 DEFINE_bool( | |
| 34 plot_sequence_number, | |
| 35 false, | |
| 36 "Plot the difference in sequence number between consecutive packets."); | |
| 37 DEFINE_bool( | |
| 38 plot_delay_change, | |
| 39 false, | |
| 40 "Plot the difference in 1-way path delay between consecutive packets."); | |
| 41 DEFINE_bool(plot_accumulated_delay_change, | |
| 42 false, | |
| 43 "Plot the accumulated 1-way path delay change, or the path delay " | |
| 44 "change compared to the first packet."); | |
| 45 DEFINE_bool(plot_total_bitrate, | |
| 46 false, | |
| 47 "Plot the total bitrate used by all streams."); | |
| 48 DEFINE_bool(plot_stream_bitrate, | |
| 49 false, | |
| 50 "Plot the bitrate used by each stream."); | |
| 51 DEFINE_bool(plot_bwe, | |
| 52 false, | |
| 53 "Run the bandwidth estimator with the logged rtp and rtcp and plot " | |
| 54 "the output."); | |
| 55 DEFINE_bool(plot_network_delay_feedback, | |
| 56 false, | |
| 57 "Compute network delay based on sent packets and the received " | |
| 58 "transport feedback."); | |
| 59 DEFINE_bool(plot_fraction_loss, | |
| 60 false, | |
| 61 "Plot packet loss in percent for outgoing packets (as perceived by " | |
| 62 "the send-side bandwidth estimator)."); | |
| 63 DEFINE_bool(plot_timestamps, | |
| 64 false, | |
| 65 "Plot the rtp timestamps of all rtp and rtcp packets over time."); | |
| 66 DEFINE_bool(audio_encoder_bitrate_bps, | |
| 67 false, | |
| 68 "Plot the audio encoder target bitrate."); | |
| 69 DEFINE_bool(audio_encoder_frame_length_ms, | |
| 70 false, | |
| 71 "Plot the audio encoder frame length."); | |
| 72 DEFINE_bool( | |
| 73 audio_encoder_uplink_packet_loss_fraction, | |
| 74 false, | |
| 75 "Plot the uplink packet loss fraction which is send to the audio encoder."); | |
| 76 DEFINE_bool(audio_encoder_fec, false, "Plot the audio encoder FEC."); | |
| 77 DEFINE_bool(audio_encoder_dtx, false, "Plot the audio encoder DTX."); | |
| 78 DEFINE_bool(audio_encoder_num_channels, | |
| 79 false, | |
| 80 "Plot the audio encoder number of channels."); | |
| 81 DEFINE_bool(plot_audio_jitter_buffer, | |
| 82 false, | |
| 83 "Plot the audio jitter buffer delay profile."); | |
| 84 DEFINE_string( | |
| 85 force_fieldtrials, | |
| 86 "", | |
| 87 "Field trials control experimental feature code which can be forced. " | |
| 88 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/" | |
| 89 " will assign the group Enabled to field trial WebRTC-FooFeature. Multiple " | |
| 90 "trials are separated by \"/\""); | |
| 91 DEFINE_bool(help, false, "prints this message"); | |
| 92 | |
| 93 int main(int argc, char* argv[]) { | |
| 94 std::string program_name = argv[0]; | |
| 95 std::string usage = | |
| 96 "A tool for visualizing WebRTC event logs.\n" | |
| 97 "Example usage:\n" + | |
| 98 program_name + " <logfile> | python\n" + "Run " + program_name + | |
| 99 " --help for a list of command line options\n"; | |
| 100 rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true); | |
| 101 if (FLAG_help) { | |
| 102 rtc::FlagList::Print(nullptr, false); | |
| 103 return 0; | |
| 104 } | |
| 105 | |
| 106 if (argc != 2) { | |
| 107 // Print usage information. | |
| 108 std::cout << usage; | |
| 109 return 0; | |
| 110 } | |
| 111 | |
| 112 webrtc::test::SetExecutablePath(argv[0]); | |
| 113 webrtc::test::InitFieldTrialsFromString(FLAG_force_fieldtrials); | |
| 114 | |
| 115 std::string filename = argv[1]; | |
| 116 | |
| 117 webrtc::ParsedRtcEventLog parsed_log; | |
| 118 | |
| 119 if (!parsed_log.ParseFile(filename)) { | |
| 120 std::cerr << "Could not parse the entire log file." << std::endl; | |
| 121 std::cerr << "Proceeding to analyze the first " | |
| 122 << parsed_log.GetNumberOfEvents() << " events in the file." | |
| 123 << std::endl; | |
| 124 } | |
| 125 | |
| 126 webrtc::plotting::EventLogAnalyzer analyzer(parsed_log); | |
| 127 std::unique_ptr<webrtc::plotting::PlotCollection> collection( | |
| 128 new webrtc::plotting::PythonPlotCollection()); | |
| 129 | |
| 130 if (FLAG_plot_all || FLAG_plot_packets) { | |
| 131 if (FLAG_incoming) { | |
| 132 analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket, | |
| 133 collection->AppendNewPlot()); | |
| 134 analyzer.CreateAccumulatedPacketsGraph( | |
| 135 webrtc::PacketDirection::kIncomingPacket, | |
| 136 collection->AppendNewPlot()); | |
| 137 } | |
| 138 if (FLAG_outgoing) { | |
| 139 analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket, | |
| 140 collection->AppendNewPlot()); | |
| 141 analyzer.CreateAccumulatedPacketsGraph( | |
| 142 webrtc::PacketDirection::kOutgoingPacket, | |
| 143 collection->AppendNewPlot()); | |
| 144 } | |
| 145 } | |
| 146 | |
| 147 if (FLAG_plot_all || FLAG_plot_audio_playout) { | |
| 148 analyzer.CreatePlayoutGraph(collection->AppendNewPlot()); | |
| 149 } | |
| 150 | |
| 151 if (FLAG_plot_all || FLAG_plot_audio_level) { | |
| 152 analyzer.CreateAudioLevelGraph(collection->AppendNewPlot()); | |
| 153 } | |
| 154 | |
| 155 if (FLAG_plot_all || FLAG_plot_sequence_number) { | |
| 156 if (FLAG_incoming) { | |
| 157 analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot()); | |
| 158 } | |
| 159 } | |
| 160 | |
| 161 if (FLAG_plot_all || FLAG_plot_delay_change) { | |
| 162 if (FLAG_incoming) { | |
| 163 analyzer.CreateDelayChangeGraph(collection->AppendNewPlot()); | |
| 164 } | |
| 165 } | |
| 166 | |
| 167 if (FLAG_plot_all || FLAG_plot_accumulated_delay_change) { | |
| 168 if (FLAG_incoming) { | |
| 169 analyzer.CreateAccumulatedDelayChangeGraph(collection->AppendNewPlot()); | |
| 170 } | |
| 171 } | |
| 172 | |
| 173 if (FLAG_plot_all || FLAG_plot_fraction_loss) { | |
| 174 analyzer.CreateFractionLossGraph(collection->AppendNewPlot()); | |
| 175 analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot()); | |
| 176 } | |
| 177 | |
| 178 if (FLAG_plot_all || FLAG_plot_total_bitrate) { | |
| 179 if (FLAG_incoming) { | |
| 180 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket, | |
| 181 collection->AppendNewPlot()); | |
| 182 } | |
| 183 if (FLAG_outgoing) { | |
| 184 analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket, | |
| 185 collection->AppendNewPlot()); | |
| 186 } | |
| 187 } | |
| 188 | |
| 189 if (FLAG_plot_all || FLAG_plot_stream_bitrate) { | |
| 190 if (FLAG_incoming) { | |
| 191 analyzer.CreateStreamBitrateGraph( | |
| 192 webrtc::PacketDirection::kIncomingPacket, | |
| 193 collection->AppendNewPlot()); | |
| 194 } | |
| 195 if (FLAG_outgoing) { | |
| 196 analyzer.CreateStreamBitrateGraph( | |
| 197 webrtc::PacketDirection::kOutgoingPacket, | |
| 198 collection->AppendNewPlot()); | |
| 199 } | |
| 200 } | |
| 201 | |
| 202 if (FLAG_plot_all || FLAG_plot_bwe) { | |
| 203 analyzer.CreateBweSimulationGraph(collection->AppendNewPlot()); | |
| 204 } | |
| 205 | |
| 206 if (FLAG_plot_all || FLAG_plot_network_delay_feedback) { | |
| 207 analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot()); | |
| 208 } | |
| 209 | |
| 210 if (FLAG_plot_all || FLAG_plot_timestamps) { | |
| 211 analyzer.CreateTimestampGraph(collection->AppendNewPlot()); | |
| 212 } | |
| 213 | |
| 214 if (FLAG_plot_all || FLAG_audio_encoder_bitrate_bps) { | |
| 215 analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot()); | |
| 216 } | |
| 217 | |
| 218 if (FLAG_plot_all || FLAG_audio_encoder_frame_length_ms) { | |
| 219 analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot()); | |
| 220 } | |
| 221 | |
| 222 if (FLAG_plot_all || FLAG_audio_encoder_uplink_packet_loss_fraction) { | |
| 223 analyzer.CreateAudioEncoderUplinkPacketLossFractionGraph( | |
| 224 collection->AppendNewPlot()); | |
| 225 } | |
| 226 | |
| 227 if (FLAG_plot_all || FLAG_audio_encoder_fec) { | |
| 228 analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot()); | |
| 229 } | |
| 230 | |
| 231 if (FLAG_plot_all || FLAG_audio_encoder_dtx) { | |
| 232 analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot()); | |
| 233 } | |
| 234 | |
| 235 if (FLAG_plot_all || FLAG_audio_encoder_num_channels) { | |
| 236 analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot()); | |
| 237 } | |
| 238 | |
| 239 if (FLAG_plot_all || FLAG_plot_audio_jitter_buffer) { | |
| 240 analyzer.CreateAudioJitterBufferGraph( | |
| 241 webrtc::test::ResourcePath( | |
| 242 "audio_processing/conversational_speech/EN_script2_F_sp2_B1", | |
| 243 "wav"), | |
| 244 48000, collection->AppendNewPlot()); | |
| 245 } | |
| 246 | |
| 247 collection->Draw(); | |
| 248 | |
| 249 return 0; | |
| 250 } | |
| OLD | NEW |