2016-07-13 06:44:41 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
Moved RtcEventLog files from call/ to logging/
The RtcEventLog headers need to be accessible from any place which needs
logging, and the implementation needs access to data structures that are
logged.
After a discussion in the code review, we all agreed to move the RtcEventLog implementation into its own top level directory - which I called "logging/" in expectation that other types of logging may have similar requirements. The directory contains two main build targets - "rtc_event_log_api", which is just rtc_event_log.h, that has no external dependencies and can be used from anywhere, and "rtc_event_log_impl" which contains the rest of the implementation and has many dependencies (more in the future).
The "api" target can be referenced from anywhere, while the "impl" target is only needed at the place of instantiation (currently Call, soon to be moved to PeerConnection by https://codereview.webrtc.org/2353033005/).
This change allows using RtcEventLog in the p2p/ directory, so that we
can log STUN pings and ICE state transitions.
BUG=webrtc:6393
R=kjellander@webrtc.org, kwiberg@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org
Review URL: https://codereview.webrtc.org/2380683005 .
Cr-Commit-Position: refs/heads/master@{#14485}
2016-10-03 18:31:22 -07:00
|
|
|
#include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
|
2017-07-06 19:44:34 +02:00
|
|
|
#include "webrtc/rtc_base/flags.h"
|
2017-06-30 03:04:59 -07:00
|
|
|
#include "webrtc/rtc_tools/event_log_visualizer/analyzer.h"
|
|
|
|
|
#include "webrtc/rtc_tools/event_log_visualizer/plot_base.h"
|
|
|
|
|
#include "webrtc/rtc_tools/event_log_visualizer/plot_python.h"
|
2016-11-15 06:54:09 -08:00
|
|
|
#include "webrtc/test/field_trial.h"
|
2017-06-14 06:09:58 -07:00
|
|
|
#include "webrtc/test/testsupport/fileutils.h"
|
2016-07-13 06:44:41 -07:00
|
|
|
|
|
|
|
|
DEFINE_bool(incoming, true, "Plot statistics for incoming packets.");
|
|
|
|
|
DEFINE_bool(outgoing, true, "Plot statistics for outgoing packets.");
|
|
|
|
|
DEFINE_bool(plot_all, true, "Plot all different data types.");
|
|
|
|
|
DEFINE_bool(plot_packets,
|
|
|
|
|
false,
|
|
|
|
|
"Plot bar graph showing the size of each packet.");
|
|
|
|
|
DEFINE_bool(plot_audio_playout,
|
|
|
|
|
false,
|
|
|
|
|
"Plot bar graph showing the time between each audio playout.");
|
2016-09-22 07:01:47 -07:00
|
|
|
DEFINE_bool(plot_audio_level,
|
|
|
|
|
false,
|
|
|
|
|
"Plot line graph showing the audio level.");
|
2016-07-13 06:44:41 -07:00
|
|
|
DEFINE_bool(
|
|
|
|
|
plot_sequence_number,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the difference in sequence number between consecutive packets.");
|
|
|
|
|
DEFINE_bool(
|
|
|
|
|
plot_delay_change,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the difference in 1-way path delay between consecutive packets.");
|
|
|
|
|
DEFINE_bool(plot_accumulated_delay_change,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the accumulated 1-way path delay change, or the path delay "
|
|
|
|
|
"change compared to the first packet.");
|
|
|
|
|
DEFINE_bool(plot_total_bitrate,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the total bitrate used by all streams.");
|
|
|
|
|
DEFINE_bool(plot_stream_bitrate,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the bitrate used by each stream.");
|
2016-07-29 14:48:54 +02:00
|
|
|
DEFINE_bool(plot_bwe,
|
|
|
|
|
false,
|
|
|
|
|
"Run the bandwidth estimator with the logged rtp and rtcp and plot "
|
|
|
|
|
"the output.");
|
2016-08-02 07:22:17 -07:00
|
|
|
DEFINE_bool(plot_network_delay_feedback,
|
|
|
|
|
false,
|
|
|
|
|
"Compute network delay based on sent packets and the received "
|
|
|
|
|
"transport feedback.");
|
2016-08-04 10:00:11 -07:00
|
|
|
DEFINE_bool(plot_fraction_loss,
|
|
|
|
|
false,
|
|
|
|
|
"Plot packet loss in percent for outgoing packets (as perceived by "
|
|
|
|
|
"the send-side bandwidth estimator).");
|
2017-02-02 08:04:18 -08:00
|
|
|
DEFINE_bool(plot_timestamps,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the rtp timestamps of all rtp and rtcp packets over time.");
|
2017-02-22 07:33:27 -08:00
|
|
|
DEFINE_bool(audio_encoder_bitrate_bps,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the audio encoder target bitrate.");
|
|
|
|
|
DEFINE_bool(audio_encoder_frame_length_ms,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the audio encoder frame length.");
|
|
|
|
|
DEFINE_bool(
|
|
|
|
|
audio_encoder_uplink_packet_loss_fraction,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the uplink packet loss fraction which is send to the audio encoder.");
|
|
|
|
|
DEFINE_bool(audio_encoder_fec, false, "Plot the audio encoder FEC.");
|
|
|
|
|
DEFINE_bool(audio_encoder_dtx, false, "Plot the audio encoder DTX.");
|
|
|
|
|
DEFINE_bool(audio_encoder_num_channels,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the audio encoder number of channels.");
|
2017-06-14 06:09:58 -07:00
|
|
|
DEFINE_bool(plot_audio_jitter_buffer,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the audio jitter buffer delay profile.");
|
2016-11-15 06:54:09 -08:00
|
|
|
DEFINE_string(
|
|
|
|
|
force_fieldtrials,
|
|
|
|
|
"",
|
|
|
|
|
"Field trials control experimental feature code which can be forced. "
|
|
|
|
|
"E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enabled/"
|
|
|
|
|
" will assign the group Enabled to field trial WebRTC-FooFeature. Multiple "
|
|
|
|
|
"trials are separated by \"/\"");
|
2017-05-16 00:01:23 -07:00
|
|
|
DEFINE_bool(help, false, "prints this message");
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2017-07-14 06:30:03 -07:00
|
|
|
DEFINE_bool(
|
|
|
|
|
show_detector_state,
|
|
|
|
|
false,
|
|
|
|
|
"Mark the delay based bwe detector state on the total bitrate graph");
|
|
|
|
|
|
2016-07-13 06:44:41 -07:00
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
std::string program_name = argv[0];
|
|
|
|
|
std::string usage =
|
|
|
|
|
"A tool for visualizing WebRTC event logs.\n"
|
|
|
|
|
"Example usage:\n" +
|
|
|
|
|
program_name + " <logfile> | python\n" + "Run " + program_name +
|
|
|
|
|
" --help for a list of command line options\n";
|
2017-05-16 00:01:23 -07:00
|
|
|
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
|
|
|
|
|
if (FLAG_help) {
|
|
|
|
|
rtc::FlagList::Print(nullptr, false);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-07-13 06:44:41 -07:00
|
|
|
|
|
|
|
|
if (argc != 2) {
|
|
|
|
|
// Print usage information.
|
2017-05-16 00:01:23 -07:00
|
|
|
std::cout << usage;
|
2016-07-13 06:44:41 -07:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-14 06:09:58 -07:00
|
|
|
webrtc::test::SetExecutablePath(argv[0]);
|
2017-05-16 00:01:23 -07:00
|
|
|
webrtc::test::InitFieldTrialsFromString(FLAG_force_fieldtrials);
|
2016-11-15 06:54:09 -08:00
|
|
|
|
2016-07-13 06:44:41 -07:00
|
|
|
std::string filename = argv[1];
|
|
|
|
|
|
|
|
|
|
webrtc::ParsedRtcEventLog parsed_log;
|
|
|
|
|
|
|
|
|
|
if (!parsed_log.ParseFile(filename)) {
|
|
|
|
|
std::cerr << "Could not parse the entire log file." << std::endl;
|
|
|
|
|
std::cerr << "Proceeding to analyze the first "
|
|
|
|
|
<< parsed_log.GetNumberOfEvents() << " events in the file."
|
|
|
|
|
<< std::endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webrtc::plotting::EventLogAnalyzer analyzer(parsed_log);
|
|
|
|
|
std::unique_ptr<webrtc::plotting::PlotCollection> collection(
|
|
|
|
|
new webrtc::plotting::PythonPlotCollection());
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_packets) {
|
|
|
|
|
if (FLAG_incoming) {
|
2016-07-13 06:44:41 -07:00
|
|
|
analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket,
|
2016-08-01 12:03:27 -07:00
|
|
|
collection->AppendNewPlot());
|
2016-09-05 02:46:25 -07:00
|
|
|
analyzer.CreateAccumulatedPacketsGraph(
|
|
|
|
|
webrtc::PacketDirection::kIncomingPacket,
|
|
|
|
|
collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_outgoing) {
|
2016-07-13 06:44:41 -07:00
|
|
|
analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket,
|
2016-08-01 12:03:27 -07:00
|
|
|
collection->AppendNewPlot());
|
2016-09-05 02:46:25 -07:00
|
|
|
analyzer.CreateAccumulatedPacketsGraph(
|
|
|
|
|
webrtc::PacketDirection::kOutgoingPacket,
|
|
|
|
|
collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_audio_playout) {
|
2016-08-01 12:03:27 -07:00
|
|
|
analyzer.CreatePlayoutGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_audio_level) {
|
2016-09-22 07:01:47 -07:00
|
|
|
analyzer.CreateAudioLevelGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_sequence_number) {
|
|
|
|
|
if (FLAG_incoming) {
|
2016-08-01 12:03:27 -07:00
|
|
|
analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_delay_change) {
|
|
|
|
|
if (FLAG_incoming) {
|
2016-08-01 12:03:27 -07:00
|
|
|
analyzer.CreateDelayChangeGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_accumulated_delay_change) {
|
|
|
|
|
if (FLAG_incoming) {
|
2016-08-01 12:03:27 -07:00
|
|
|
analyzer.CreateAccumulatedDelayChangeGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_fraction_loss) {
|
2016-08-04 10:00:11 -07:00
|
|
|
analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
|
2016-09-09 13:37:50 +02:00
|
|
|
analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
|
2016-08-04 10:00:11 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_total_bitrate) {
|
|
|
|
|
if (FLAG_incoming) {
|
2016-07-13 06:44:41 -07:00
|
|
|
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
|
2017-07-14 06:30:03 -07:00
|
|
|
collection->AppendNewPlot(),
|
|
|
|
|
FLAG_show_detector_state);
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_outgoing) {
|
2016-07-13 06:44:41 -07:00
|
|
|
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
|
2017-07-14 06:30:03 -07:00
|
|
|
collection->AppendNewPlot(),
|
|
|
|
|
FLAG_show_detector_state);
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_stream_bitrate) {
|
|
|
|
|
if (FLAG_incoming) {
|
2016-07-13 06:44:41 -07:00
|
|
|
analyzer.CreateStreamBitrateGraph(
|
|
|
|
|
webrtc::PacketDirection::kIncomingPacket,
|
2016-08-01 12:03:27 -07:00
|
|
|
collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_outgoing) {
|
2016-07-13 06:44:41 -07:00
|
|
|
analyzer.CreateStreamBitrateGraph(
|
|
|
|
|
webrtc::PacketDirection::kOutgoingPacket,
|
2016-08-01 12:03:27 -07:00
|
|
|
collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_bwe) {
|
2016-08-15 08:47:14 -07:00
|
|
|
analyzer.CreateBweSimulationGraph(collection->AppendNewPlot());
|
2016-07-29 14:48:54 +02:00
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_network_delay_feedback) {
|
2016-08-15 08:47:14 -07:00
|
|
|
analyzer.CreateNetworkDelayFeedbackGraph(collection->AppendNewPlot());
|
2016-08-02 07:22:17 -07:00
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_timestamps) {
|
2017-02-02 08:04:18 -08:00
|
|
|
analyzer.CreateTimestampGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_audio_encoder_bitrate_bps) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_audio_encoder_frame_length_ms) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_audio_encoder_uplink_packet_loss_fraction) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderUplinkPacketLossFractionGraph(
|
|
|
|
|
collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_audio_encoder_fec) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_audio_encoder_dtx) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-16 00:01:23 -07:00
|
|
|
if (FLAG_plot_all || FLAG_audio_encoder_num_channels) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-14 06:09:58 -07:00
|
|
|
if (FLAG_plot_all || FLAG_plot_audio_jitter_buffer) {
|
|
|
|
|
analyzer.CreateAudioJitterBufferGraph(
|
|
|
|
|
webrtc::test::ResourcePath(
|
|
|
|
|
"audio_processing/conversational_speech/EN_script2_F_sp2_B1",
|
|
|
|
|
"wav"),
|
|
|
|
|
48000, collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-01 12:03:27 -07:00
|
|
|
collection->Draw();
|
2016-07-13 06:44:41 -07:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|