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
|
|
|
|
2017-08-15 02:04:02 -07:00
|
|
|
DEFINE_string(plot_profile,
|
|
|
|
|
"default",
|
|
|
|
|
"A profile that selects a certain subset of the plots. Currently "
|
|
|
|
|
"defined profiles are \"all\", \"none\" and \"default\"");
|
|
|
|
|
|
|
|
|
|
DEFINE_bool(plot_incoming_packet_sizes,
|
|
|
|
|
false,
|
|
|
|
|
"Plot bar graph showing the size of each incoming packet.");
|
|
|
|
|
DEFINE_bool(plot_outgoing_packet_sizes,
|
|
|
|
|
false,
|
|
|
|
|
"Plot bar graph showing the size of each outgoing packet.");
|
|
|
|
|
DEFINE_bool(plot_incoming_packet_count,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the accumulated number of packets for each incoming stream.");
|
|
|
|
|
DEFINE_bool(plot_outgoing_packet_count,
|
2016-07-13 06:44:41 -07:00
|
|
|
false,
|
2017-08-15 02:04:02 -07:00
|
|
|
"Plot the accumulated number of packets for each outgoing stream.");
|
2016-07-13 06:44:41 -07:00
|
|
|
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,
|
2017-08-15 02:04:02 -07:00
|
|
|
"Plot line graph showing the audio level of incoming audio.");
|
|
|
|
|
DEFINE_bool(plot_incoming_sequence_number_delta,
|
|
|
|
|
false,
|
|
|
|
|
"Plot the sequence number difference between consecutive incoming "
|
|
|
|
|
"packets.");
|
2016-07-13 06:44:41 -07:00
|
|
|
DEFINE_bool(
|
2017-08-15 02:04:02 -07:00
|
|
|
plot_incoming_delay_delta,
|
2016-07-13 06:44:41 -07:00
|
|
|
false,
|
|
|
|
|
"Plot the difference in 1-way path delay between consecutive packets.");
|
2017-08-15 02:04:02 -07:00
|
|
|
DEFINE_bool(plot_incoming_delay,
|
|
|
|
|
true,
|
|
|
|
|
"Plot the 1-way path delay for incoming packets, normalized so "
|
|
|
|
|
"that the first packet has delay 0.");
|
|
|
|
|
DEFINE_bool(plot_incoming_loss_rate,
|
|
|
|
|
true,
|
|
|
|
|
"Compute the loss rate for incoming packets using a method that's "
|
|
|
|
|
"similar to the one used for RTCP SR and RR fraction lost. Note "
|
|
|
|
|
"that the loss rate can be negative if packets are duplicated or "
|
|
|
|
|
"reordered.");
|
|
|
|
|
DEFINE_bool(plot_incoming_bitrate,
|
|
|
|
|
true,
|
|
|
|
|
"Plot the total bitrate used by all incoming streams.");
|
|
|
|
|
DEFINE_bool(plot_outgoing_bitrate,
|
|
|
|
|
true,
|
|
|
|
|
"Plot the total bitrate used by all outgoing streams.");
|
|
|
|
|
DEFINE_bool(plot_incoming_stream_bitrate,
|
|
|
|
|
true,
|
|
|
|
|
"Plot the bitrate used by each incoming stream.");
|
|
|
|
|
DEFINE_bool(plot_outgoing_stream_bitrate,
|
|
|
|
|
true,
|
|
|
|
|
"Plot the bitrate used by each outgoing stream.");
|
|
|
|
|
DEFINE_bool(plot_simulated_sendside_bwe,
|
2016-07-13 06:44:41 -07:00
|
|
|
false,
|
2017-08-15 02:04:02 -07:00
|
|
|
"Run the send-side bandwidth estimator with the outgoing rtp and "
|
|
|
|
|
"incoming rtcp and plot the resulting estimate.");
|
2016-08-02 07:22:17 -07:00
|
|
|
DEFINE_bool(plot_network_delay_feedback,
|
2017-08-15 02:04:02 -07:00
|
|
|
true,
|
2016-08-02 07:22:17 -07:00
|
|
|
"Compute network delay based on sent packets and the received "
|
|
|
|
|
"transport feedback.");
|
2017-08-15 02:04:02 -07:00
|
|
|
DEFINE_bool(plot_fraction_loss_feedback,
|
|
|
|
|
true,
|
2016-08-04 10:00:11 -07:00
|
|
|
"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-08-15 02:04:02 -07:00
|
|
|
DEFINE_bool(plot_audio_encoder_bitrate_bps,
|
2017-02-22 07:33:27 -08:00
|
|
|
false,
|
|
|
|
|
"Plot the audio encoder target bitrate.");
|
2017-08-15 02:04:02 -07:00
|
|
|
DEFINE_bool(plot_audio_encoder_frame_length_ms,
|
2017-02-22 07:33:27 -08:00
|
|
|
false,
|
|
|
|
|
"Plot the audio encoder frame length.");
|
|
|
|
|
DEFINE_bool(
|
2017-08-15 02:04:02 -07:00
|
|
|
plot_audio_encoder_packet_loss,
|
2017-02-22 07:33:27 -08:00
|
|
|
false,
|
2017-08-15 02:04:02 -07:00
|
|
|
"Plot the uplink packet loss fraction which is sent to the audio encoder.");
|
|
|
|
|
DEFINE_bool(plot_audio_encoder_fec, false, "Plot the audio encoder FEC.");
|
|
|
|
|
DEFINE_bool(plot_audio_encoder_dtx, false, "Plot the audio encoder DTX.");
|
|
|
|
|
DEFINE_bool(plot_audio_encoder_num_channels,
|
2017-02-22 07:33:27 -08:00
|
|
|
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-08-16 02:48:33 -07:00
|
|
|
DEFINE_string(wav_filename,
|
|
|
|
|
"",
|
|
|
|
|
"Path to wav file used for simulation of jitter buffer");
|
2017-05-16 00:01:23 -07:00
|
|
|
DEFINE_bool(help, false, "prints this message");
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2017-08-15 02:04:02 -07:00
|
|
|
DEFINE_bool(show_detector_state,
|
|
|
|
|
false,
|
|
|
|
|
"Show the state of the delay based BWE detector on the total "
|
|
|
|
|
"bitrate graph");
|
|
|
|
|
|
|
|
|
|
void SetAllPlotFlags(bool setting);
|
|
|
|
|
|
2017-07-14 06:30:03 -07:00
|
|
|
|
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-08-15 02:04:02 -07:00
|
|
|
|
|
|
|
|
// Parse command line flags without removing them. We're only interested in
|
|
|
|
|
// the |plot_profile| flag.
|
|
|
|
|
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false);
|
|
|
|
|
if (strcmp(FLAG_plot_profile, "all") == 0) {
|
|
|
|
|
SetAllPlotFlags(true);
|
|
|
|
|
} else if (strcmp(FLAG_plot_profile, "none") == 0) {
|
|
|
|
|
SetAllPlotFlags(false);
|
|
|
|
|
} else if (strcmp(FLAG_plot_profile, "default") == 0) {
|
|
|
|
|
// Do nothing.
|
|
|
|
|
} else {
|
|
|
|
|
rtc::Flag* plot_profile_flag = rtc::FlagList::Lookup("plot_profile");
|
|
|
|
|
RTC_CHECK(plot_profile_flag);
|
|
|
|
|
plot_profile_flag->Print(false);
|
|
|
|
|
}
|
|
|
|
|
// Parse the remaining flags. They are applied relative to the chosen profile.
|
2017-05-16 00:01:23 -07:00
|
|
|
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
|
2017-08-15 02:04:02 -07:00
|
|
|
|
2017-07-20 08:05:09 -07:00
|
|
|
if (argc != 2 || FLAG_help) {
|
2016-07-13 06:44:41 -07:00
|
|
|
// Print usage information.
|
2017-05-16 00:01:23 -07:00
|
|
|
std::cout << usage;
|
2017-07-20 08:05:09 -07:00
|
|
|
if (FLAG_help)
|
|
|
|
|
rtc::FlagList::Print(nullptr, false);
|
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-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_incoming_packet_sizes) {
|
|
|
|
|
analyzer.CreatePacketGraph(webrtc::PacketDirection::kIncomingPacket,
|
|
|
|
|
collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_outgoing_packet_sizes) {
|
|
|
|
|
analyzer.CreatePacketGraph(webrtc::PacketDirection::kOutgoingPacket,
|
|
|
|
|
collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_incoming_packet_count) {
|
|
|
|
|
analyzer.CreateAccumulatedPacketsGraph(
|
|
|
|
|
webrtc::PacketDirection::kIncomingPacket, collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_outgoing_packet_count) {
|
|
|
|
|
analyzer.CreateAccumulatedPacketsGraph(
|
|
|
|
|
webrtc::PacketDirection::kOutgoingPacket, collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (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-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_level) {
|
2016-09-22 07:01:47 -07:00
|
|
|
analyzer.CreateAudioLevelGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_incoming_sequence_number_delta) {
|
|
|
|
|
analyzer.CreateSequenceNumberGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_incoming_delay_delta) {
|
|
|
|
|
analyzer.CreateIncomingDelayDeltaGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_incoming_delay) {
|
|
|
|
|
analyzer.CreateIncomingDelayGraph(collection->AppendNewPlot());
|
2016-07-13 06:44:41 -07:00
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_incoming_loss_rate) {
|
2016-09-09 13:37:50 +02:00
|
|
|
analyzer.CreateIncomingPacketLossGraph(collection->AppendNewPlot());
|
2016-08-04 10:00:11 -07:00
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_incoming_bitrate) {
|
|
|
|
|
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
|
|
|
|
|
collection->AppendNewPlot(),
|
|
|
|
|
FLAG_show_detector_state);
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_outgoing_bitrate) {
|
|
|
|
|
analyzer.CreateTotalBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
|
|
|
|
|
collection->AppendNewPlot(),
|
|
|
|
|
FLAG_show_detector_state);
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_incoming_stream_bitrate) {
|
|
|
|
|
analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kIncomingPacket,
|
|
|
|
|
collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_outgoing_stream_bitrate) {
|
|
|
|
|
analyzer.CreateStreamBitrateGraph(webrtc::PacketDirection::kOutgoingPacket,
|
|
|
|
|
collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_simulated_sendside_bwe) {
|
2016-08-15 08:47:14 -07:00
|
|
|
analyzer.CreateBweSimulationGraph(collection->AppendNewPlot());
|
2016-07-29 14:48:54 +02:00
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (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-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_fraction_loss_feedback) {
|
|
|
|
|
analyzer.CreateFractionLossGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
|
|
|
|
if (FLAG_plot_timestamps) {
|
2017-02-02 08:04:18 -08:00
|
|
|
analyzer.CreateTimestampGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_encoder_bitrate_bps) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderTargetBitrateGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_encoder_frame_length_ms) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderFrameLengthGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_encoder_packet_loss) {
|
|
|
|
|
analyzer.CreateAudioEncoderPacketLossGraph(collection->AppendNewPlot());
|
2017-02-22 07:33:27 -08:00
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_encoder_fec) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderEnableFecGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_encoder_dtx) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderEnableDtxGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_encoder_num_channels) {
|
2017-02-22 07:33:27 -08:00
|
|
|
analyzer.CreateAudioEncoderNumChannelsGraph(collection->AppendNewPlot());
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
if (FLAG_plot_audio_jitter_buffer) {
|
2017-08-16 02:48:33 -07:00
|
|
|
std::string wav_path;
|
|
|
|
|
if (FLAG_wav_filename[0] != '\0') {
|
|
|
|
|
wav_path = FLAG_wav_filename;
|
|
|
|
|
} else {
|
|
|
|
|
wav_path = webrtc::test::ResourcePath(
|
|
|
|
|
"audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav");
|
|
|
|
|
}
|
|
|
|
|
analyzer.CreateAudioJitterBufferGraph(wav_path, 48000,
|
|
|
|
|
collection->AppendNewPlot());
|
2017-06-14 06:09:58 -07:00
|
|
|
}
|
|
|
|
|
|
2016-08-01 12:03:27 -07:00
|
|
|
collection->Draw();
|
2016-07-13 06:44:41 -07:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2017-08-15 02:04:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetAllPlotFlags(bool setting) {
|
|
|
|
|
FLAG_plot_incoming_packet_sizes = setting;
|
|
|
|
|
FLAG_plot_outgoing_packet_sizes = setting;
|
|
|
|
|
FLAG_plot_incoming_packet_count = setting;
|
|
|
|
|
FLAG_plot_outgoing_packet_count = setting;
|
|
|
|
|
FLAG_plot_audio_playout = setting;
|
|
|
|
|
FLAG_plot_audio_level = setting;
|
|
|
|
|
FLAG_plot_incoming_sequence_number_delta = setting;
|
|
|
|
|
FLAG_plot_incoming_delay_delta = setting;
|
|
|
|
|
FLAG_plot_incoming_delay = setting;
|
|
|
|
|
FLAG_plot_incoming_loss_rate = setting;
|
|
|
|
|
FLAG_plot_incoming_bitrate = setting;
|
|
|
|
|
FLAG_plot_outgoing_bitrate = setting;
|
|
|
|
|
FLAG_plot_incoming_stream_bitrate = setting;
|
|
|
|
|
FLAG_plot_outgoing_stream_bitrate = setting;
|
|
|
|
|
FLAG_plot_simulated_sendside_bwe = setting;
|
|
|
|
|
FLAG_plot_network_delay_feedback = setting;
|
|
|
|
|
FLAG_plot_fraction_loss_feedback = setting;
|
|
|
|
|
FLAG_plot_timestamps = setting;
|
|
|
|
|
FLAG_plot_audio_encoder_bitrate_bps = setting;
|
|
|
|
|
FLAG_plot_audio_encoder_frame_length_ms = setting;
|
|
|
|
|
FLAG_plot_audio_encoder_packet_loss = setting;
|
|
|
|
|
FLAG_plot_audio_encoder_fec = setting;
|
|
|
|
|
FLAG_plot_audio_encoder_dtx = setting;
|
|
|
|
|
FLAG_plot_audio_encoder_num_channels = setting;
|
|
|
|
|
FLAG_plot_audio_jitter_buffer = setting;
|
|
|
|
|
}
|