Add rtc_ prefix to the event_log_visualizer directory.

No-Try: True
Bug: None
Change-Id: Iaa2b273ddab6567321f11bf74a91751cbdf957a5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146710
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28681}
This commit is contained in:
Mirko Bonadei
2019-07-25 13:57:41 +02:00
committed by Commit Bot
parent a72d583271
commit 575998c2da
16 changed files with 49 additions and 49 deletions

View File

@ -0,0 +1 @@
terelius@webrtc.org

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,305 @@
/*
* 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.
*/
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
#include "rtc_tools/rtc_event_log_visualizer/triage_notifications.h"
namespace webrtc {
class AnalyzerConfig {
public:
float GetCallTimeSec(int64_t timestamp_us) const {
int64_t offset = normalize_time_ ? begin_time_ : 0;
return static_cast<float>(timestamp_us - offset) / 1000000;
}
float CallBeginTimeSec() const { return GetCallTimeSec(begin_time_); }
float CallEndTimeSec() const { return GetCallTimeSec(end_time_); }
// Window and step size used for calculating moving averages, e.g. bitrate.
// The generated data points will be |step_| microseconds apart.
// Only events occurring at most |window_duration_| microseconds before the
// current data point will be part of the average.
int64_t window_duration_;
int64_t step_;
// First and last events of the log.
int64_t begin_time_;
int64_t end_time_;
bool normalize_time_;
};
class EventLogAnalyzer {
public:
// The EventLogAnalyzer keeps a reference to the ParsedRtcEventLogNew for the
// duration of its lifetime. The ParsedRtcEventLogNew must not be destroyed or
// modified while the EventLogAnalyzer is being used.
EventLogAnalyzer(const ParsedRtcEventLog& log, bool normalize_time);
void CreatePacketGraph(PacketDirection direction, Plot* plot);
void CreateRtcpTypeGraph(PacketDirection direction, Plot* plot);
void CreateAccumulatedPacketsGraph(PacketDirection direction, Plot* plot);
void CreatePlayoutGraph(Plot* plot);
void CreateAudioLevelGraph(PacketDirection direction, Plot* plot);
void CreateSequenceNumberGraph(Plot* plot);
void CreateIncomingPacketLossGraph(Plot* plot);
void CreateIncomingDelayGraph(Plot* plot);
void CreateFractionLossGraph(Plot* plot);
void CreateTotalIncomingBitrateGraph(Plot* plot);
void CreateTotalOutgoingBitrateGraph(Plot* plot,
bool show_detector_state = false,
bool show_alr_state = false);
void CreateStreamBitrateGraph(PacketDirection direction, Plot* plot);
void CreateBitrateAllocationGraph(PacketDirection direction, Plot* plot);
void CreateGoogCcSimulationGraph(Plot* plot);
void CreateSendSideBweSimulationGraph(Plot* plot);
void CreateReceiveSideBweSimulationGraph(Plot* plot);
void CreateNetworkDelayFeedbackGraph(Plot* plot);
void CreatePacerDelayGraph(Plot* plot);
void CreateTimestampGraph(PacketDirection direction, Plot* plot);
void CreateSenderAndReceiverReportPlot(
PacketDirection direction,
rtc::FunctionView<float(const rtcp::ReportBlock&)> fy,
std::string title,
std::string yaxis_label,
Plot* plot);
void CreateAudioEncoderTargetBitrateGraph(Plot* plot);
void CreateAudioEncoderFrameLengthGraph(Plot* plot);
void CreateAudioEncoderPacketLossGraph(Plot* plot);
void CreateAudioEncoderEnableFecGraph(Plot* plot);
void CreateAudioEncoderEnableDtxGraph(Plot* plot);
void CreateAudioEncoderNumChannelsGraph(Plot* plot);
using NetEqStatsGetterMap =
std::map<uint32_t, std::unique_ptr<test::NetEqStatsGetter>>;
NetEqStatsGetterMap SimulateNetEq(const std::string& replacement_file_name,
int file_sample_rate_hz) const;
void CreateAudioJitterBufferGraph(uint32_t ssrc,
const test::NetEqStatsGetter* stats_getter,
Plot* plot) const;
void CreateNetEqNetworkStatsGraph(
const NetEqStatsGetterMap& neteq_stats_getters,
rtc::FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
const std::string& plot_name,
Plot* plot) const;
void CreateNetEqLifetimeStatsGraph(
const NetEqStatsGetterMap& neteq_stats_getters,
rtc::FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
const std::string& plot_name,
Plot* plot) const;
void CreateIceCandidatePairConfigGraph(Plot* plot);
void CreateIceConnectivityCheckGraph(Plot* plot);
void CreateDtlsTransportStateGraph(Plot* plot);
void CreateDtlsWritableStateGraph(Plot* plot);
void CreateTriageNotifications();
void PrintNotifications(FILE* file);
private:
struct LayerDescription {
LayerDescription(uint32_t ssrc,
uint8_t spatial_layer,
uint8_t temporal_layer)
: ssrc(ssrc),
spatial_layer(spatial_layer),
temporal_layer(temporal_layer) {}
bool operator<(const LayerDescription& other) const {
if (ssrc != other.ssrc)
return ssrc < other.ssrc;
if (spatial_layer != other.spatial_layer)
return spatial_layer < other.spatial_layer;
return temporal_layer < other.temporal_layer;
}
uint32_t ssrc;
uint8_t spatial_layer;
uint8_t temporal_layer;
};
bool IsRtxSsrc(PacketDirection direction, uint32_t ssrc) const {
if (direction == kIncomingPacket) {
return parsed_log_.incoming_rtx_ssrcs().find(ssrc) !=
parsed_log_.incoming_rtx_ssrcs().end();
} else {
return parsed_log_.outgoing_rtx_ssrcs().find(ssrc) !=
parsed_log_.outgoing_rtx_ssrcs().end();
}
}
bool IsVideoSsrc(PacketDirection direction, uint32_t ssrc) const {
if (direction == kIncomingPacket) {
return parsed_log_.incoming_video_ssrcs().find(ssrc) !=
parsed_log_.incoming_video_ssrcs().end();
} else {
return parsed_log_.outgoing_video_ssrcs().find(ssrc) !=
parsed_log_.outgoing_video_ssrcs().end();
}
}
bool IsAudioSsrc(PacketDirection direction, uint32_t ssrc) const {
if (direction == kIncomingPacket) {
return parsed_log_.incoming_audio_ssrcs().find(ssrc) !=
parsed_log_.incoming_audio_ssrcs().end();
} else {
return parsed_log_.outgoing_audio_ssrcs().find(ssrc) !=
parsed_log_.outgoing_audio_ssrcs().end();
}
}
template <typename NetEqStatsType>
void CreateNetEqStatsGraphInternal(
const NetEqStatsGetterMap& neteq_stats,
rtc::FunctionView<const std::vector<std::pair<int64_t, NetEqStatsType>>*(
const test::NetEqStatsGetter*)> data_extractor,
rtc::FunctionView<float(const NetEqStatsType&)> stats_extractor,
const std::string& plot_name,
Plot* plot) const;
template <typename IterableType>
void CreateAccumulatedPacketsTimeSeries(Plot* plot,
const IterableType& packets,
const std::string& label);
void CreateStreamGapAlerts(PacketDirection direction);
void CreateTransmissionGapAlerts(PacketDirection direction);
std::string GetStreamName(PacketDirection direction, uint32_t ssrc) const {
char buffer[200];
rtc::SimpleStringBuilder name(buffer);
if (IsAudioSsrc(direction, ssrc)) {
name << "Audio ";
} else if (IsVideoSsrc(direction, ssrc)) {
name << "Video ";
} else {
name << "Unknown ";
}
if (IsRtxSsrc(direction, ssrc)) {
name << "RTX ";
}
if (direction == kIncomingPacket)
name << "(In) ";
else
name << "(Out) ";
name << "SSRC " << ssrc;
return name.str();
}
std::string GetLayerName(LayerDescription layer) const {
char buffer[100];
rtc::SimpleStringBuilder name(buffer);
name << "SSRC " << layer.ssrc << " sl " << layer.spatial_layer << ", tl "
<< layer.temporal_layer;
return name.str();
}
void Alert_RtpLogTimeGap(PacketDirection direction,
float time_seconds,
int64_t duration) {
if (direction == kIncomingPacket) {
incoming_rtp_recv_time_gaps_.emplace_back(time_seconds, duration);
} else {
outgoing_rtp_send_time_gaps_.emplace_back(time_seconds, duration);
}
}
void Alert_RtcpLogTimeGap(PacketDirection direction,
float time_seconds,
int64_t duration) {
if (direction == kIncomingPacket) {
incoming_rtcp_recv_time_gaps_.emplace_back(time_seconds, duration);
} else {
outgoing_rtcp_send_time_gaps_.emplace_back(time_seconds, duration);
}
}
void Alert_SeqNumJump(PacketDirection direction,
float time_seconds,
uint32_t ssrc) {
if (direction == kIncomingPacket) {
incoming_seq_num_jumps_.emplace_back(time_seconds, ssrc);
} else {
outgoing_seq_num_jumps_.emplace_back(time_seconds, ssrc);
}
}
void Alert_CaptureTimeJump(PacketDirection direction,
float time_seconds,
uint32_t ssrc) {
if (direction == kIncomingPacket) {
incoming_capture_time_jumps_.emplace_back(time_seconds, ssrc);
} else {
outgoing_capture_time_jumps_.emplace_back(time_seconds, ssrc);
}
}
void Alert_OutgoingHighLoss(double avg_loss_fraction) {
outgoing_high_loss_alerts_.emplace_back(avg_loss_fraction);
}
std::string GetCandidatePairLogDescriptionFromId(uint32_t candidate_pair_id);
const ParsedRtcEventLog& parsed_log_;
// A list of SSRCs we are interested in analysing.
// If left empty, all SSRCs will be considered relevant.
std::vector<uint32_t> desired_ssrc_;
// Stores the timestamps for all log segments, in the form of associated start
// and end events.
std::vector<std::pair<int64_t, int64_t>> log_segments_;
std::vector<IncomingRtpReceiveTimeGap> incoming_rtp_recv_time_gaps_;
std::vector<IncomingRtcpReceiveTimeGap> incoming_rtcp_recv_time_gaps_;
std::vector<OutgoingRtpSendTimeGap> outgoing_rtp_send_time_gaps_;
std::vector<OutgoingRtcpSendTimeGap> outgoing_rtcp_send_time_gaps_;
std::vector<IncomingSeqNumJump> incoming_seq_num_jumps_;
std::vector<IncomingCaptureTimeJump> incoming_capture_time_jumps_;
std::vector<OutgoingSeqNoJump> outgoing_seq_num_jumps_;
std::vector<OutgoingCaptureTimeJump> outgoing_capture_time_jumps_;
std::vector<OutgoingHighLoss> outgoing_high_loss_alerts_;
std::map<uint32_t, std::string> candidate_pair_desc_by_id_;
AnalyzerConfig config_;
};
} // namespace webrtc
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_

View File

@ -0,0 +1,207 @@
/*
* Copyright 2019 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 "rtc_tools/rtc_event_log_visualizer/log_simulation.h"
#include <algorithm>
#include <utility>
#include "logging/rtc_event_log/rtc_event_processor.h"
#include "modules/rtp_rtcp/source/time_util.h"
namespace webrtc {
LogBasedNetworkControllerSimulation::LogBasedNetworkControllerSimulation(
std::unique_ptr<NetworkControllerFactoryInterface> factory,
std::function<void(const NetworkControlUpdate&, Timestamp)> update_handler)
: update_handler_(update_handler), factory_(std::move(factory)) {}
LogBasedNetworkControllerSimulation::~LogBasedNetworkControllerSimulation() {}
void LogBasedNetworkControllerSimulation::HandleStateUpdate(
const NetworkControlUpdate& update) {
update_handler_(update, current_time_);
}
void LogBasedNetworkControllerSimulation::ProcessUntil(Timestamp to_time) {
if (last_process_.IsInfinite()) {
NetworkControllerConfig config;
config.constraints.at_time = to_time;
config.constraints.min_data_rate = DataRate::kbps(30);
config.constraints.starting_rate = DataRate::kbps(300);
config.event_log = &null_event_log_;
controller_ = factory_->Create(config);
}
if (last_process_.IsInfinite() ||
to_time - last_process_ > TimeDelta::seconds(1)) {
last_process_ = to_time;
current_time_ = to_time;
ProcessInterval msg;
msg.at_time = to_time;
HandleStateUpdate(controller_->OnProcessInterval(msg));
} else {
while (last_process_ + factory_->GetProcessInterval() <= to_time) {
last_process_ += factory_->GetProcessInterval();
current_time_ = last_process_;
ProcessInterval msg;
msg.at_time = current_time_;
HandleStateUpdate(controller_->OnProcessInterval(msg));
}
current_time_ = to_time;
}
}
void LogBasedNetworkControllerSimulation::OnProbeCreated(
const LoggedBweProbeClusterCreatedEvent& probe_cluster) {
pending_probes_.push_back({probe_cluster, 0, 0});
}
void LogBasedNetworkControllerSimulation::OnPacketSent(
const LoggedPacketInfo& packet) {
ProcessUntil(packet.log_packet_time);
if (packet.has_transport_seq_no) {
PacedPacketInfo probe_info;
if (!pending_probes_.empty() &&
packet.media_type == LoggedMediaType::kVideo) {
auto& probe = pending_probes_.front();
probe_info.probe_cluster_id = probe.event.id;
probe_info.send_bitrate_bps = probe.event.bitrate_bps;
probe_info.probe_cluster_min_bytes = probe.event.min_bytes;
probe_info.probe_cluster_min_probes = probe.event.min_packets;
probe.packets_sent++;
probe.bytes_sent += packet.size + packet.overhead;
if (probe.bytes_sent >= probe.event.min_bytes &&
probe.packets_sent >= probe.event.min_packets) {
pending_probes_.pop_front();
}
}
RtpPacketSendInfo packet_info;
packet_info.ssrc = packet.ssrc;
packet_info.transport_sequence_number = packet.transport_seq_no;
packet_info.rtp_sequence_number = packet.stream_seq_no;
packet_info.has_rtp_sequence_number = true;
packet_info.length = packet.size;
packet_info.pacing_info = probe_info;
transport_feedback_.AddPacket(packet_info, packet.overhead,
packet.log_packet_time);
}
rtc::SentPacket sent_packet;
sent_packet.send_time_ms = packet.log_packet_time.ms();
sent_packet.info.included_in_allocation = true;
sent_packet.info.packet_size_bytes = packet.size + packet.overhead;
if (packet.has_transport_seq_no) {
sent_packet.packet_id = packet.transport_seq_no;
sent_packet.info.included_in_feedback = true;
}
auto msg = transport_feedback_.ProcessSentPacket(sent_packet);
if (msg)
HandleStateUpdate(controller_->OnSentPacket(*msg));
}
void LogBasedNetworkControllerSimulation::OnFeedback(
const LoggedRtcpPacketTransportFeedback& feedback) {
auto feedback_time = Timestamp::ms(feedback.log_time_ms());
ProcessUntil(feedback_time);
auto msg = transport_feedback_.ProcessTransportFeedback(
feedback.transport_feedback, feedback_time);
if (msg)
HandleStateUpdate(controller_->OnTransportPacketsFeedback(*msg));
}
void LogBasedNetworkControllerSimulation::OnReceiverReport(
const LoggedRtcpPacketReceiverReport& report) {
if (report.rr.report_blocks().empty())
return;
auto report_time = Timestamp::ms(report.log_time_ms());
ProcessUntil(report_time);
int packets_delta = 0;
int lost_delta = 0;
for (auto& block : report.rr.report_blocks()) {
auto it = last_report_blocks_.find(block.source_ssrc());
if (it != last_report_blocks_.end()) {
packets_delta +=
block.extended_high_seq_num() - it->second.extended_high_seq_num();
lost_delta += block.cumulative_lost() - it->second.cumulative_lost();
}
last_report_blocks_[block.source_ssrc()] = block;
}
if (packets_delta > lost_delta) {
TransportLossReport msg;
msg.packets_lost_delta = lost_delta;
msg.packets_received_delta = packets_delta - lost_delta;
msg.receive_time = report_time;
msg.start_time = last_report_block_time_;
msg.end_time = report_time;
last_report_block_time_ = report_time;
HandleStateUpdate(controller_->OnTransportLossReport(msg));
}
TimeDelta rtt = TimeDelta::PlusInfinity();
for (auto& rb : report.rr.report_blocks()) {
if (rb.last_sr()) {
uint32_t receive_time_ntp =
CompactNtp(TimeMicrosToNtp(report.log_time_us()));
uint32_t rtt_ntp =
receive_time_ntp - rb.delay_since_last_sr() - rb.last_sr();
rtt = std::min(rtt, TimeDelta::ms(CompactNtpRttToMs(rtt_ntp)));
}
}
if (rtt.IsFinite()) {
RoundTripTimeUpdate msg;
msg.receive_time = report_time;
msg.round_trip_time = rtt;
HandleStateUpdate(controller_->OnRoundTripTimeUpdate(msg));
}
}
void LogBasedNetworkControllerSimulation::OnIceConfig(
const LoggedIceCandidatePairConfig& candidate) {
if (candidate.type == IceCandidatePairConfigType::kSelected) {
auto log_time = Timestamp::us(candidate.log_time_us());
ProcessUntil(log_time);
NetworkRouteChange msg;
msg.at_time = log_time;
msg.constraints.min_data_rate = DataRate::kbps(30);
msg.constraints.starting_rate = DataRate::kbps(300);
msg.constraints.at_time = log_time;
HandleStateUpdate(controller_->OnNetworkRouteChange(msg));
}
}
void LogBasedNetworkControllerSimulation::ProcessEventsInLog(
const ParsedRtcEventLog& parsed_log_) {
auto packet_infos = parsed_log_.GetOutgoingPacketInfos();
RtcEventProcessor processor;
processor.AddEvents(
parsed_log_.bwe_probe_cluster_created_events(),
[this](const LoggedBweProbeClusterCreatedEvent& probe_cluster) {
OnProbeCreated(probe_cluster);
});
processor.AddEvents(packet_infos, [this](const LoggedPacketInfo& packet) {
OnPacketSent(packet);
});
processor.AddEvents(
parsed_log_.transport_feedbacks(PacketDirection::kIncomingPacket),
[this](const LoggedRtcpPacketTransportFeedback& feedback) {
OnFeedback(feedback);
});
processor.AddEvents(
parsed_log_.receiver_reports(PacketDirection::kIncomingPacket),
[this](const LoggedRtcpPacketReceiverReport& report) {
OnReceiverReport(report);
});
processor.AddEvents(parsed_log_.ice_candidate_pair_configs(),
[this](const LoggedIceCandidatePairConfig& candidate) {
OnIceConfig(candidate);
});
processor.ProcessEventsInOrder();
}
} // namespace webrtc

View File

@ -0,0 +1,64 @@
/*
* Copyright 2019 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.
*/
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_LOG_SIMULATION_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_LOG_SIMULATION_H_
#include <deque>
#include <functional>
#include <map>
#include <memory>
#include <vector>
#include "api/transport/network_control.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/congestion_controller/rtp/transport_feedback_adapter.h"
namespace webrtc {
class LogBasedNetworkControllerSimulation {
public:
explicit LogBasedNetworkControllerSimulation(
std::unique_ptr<NetworkControllerFactoryInterface> factory,
std::function<void(const NetworkControlUpdate&, Timestamp)>
update_handler);
~LogBasedNetworkControllerSimulation();
void ProcessEventsInLog(const ParsedRtcEventLog& parsed_log_);
private:
struct ProbingStatus {
const LoggedBweProbeClusterCreatedEvent event;
size_t bytes_sent;
size_t packets_sent;
};
void HandleStateUpdate(const NetworkControlUpdate& update);
void ProcessUntil(Timestamp to_time);
void OnProbeCreated(const LoggedBweProbeClusterCreatedEvent& probe_cluster);
void OnPacketSent(const LoggedPacketInfo& packet);
void OnFeedback(const LoggedRtcpPacketTransportFeedback& feedback);
void OnReceiverReport(const LoggedRtcpPacketReceiverReport& report);
void OnIceConfig(const LoggedIceCandidatePairConfig& candidate);
RtcEventLogNullImpl null_event_log_;
const std::function<void(const NetworkControlUpdate&, Timestamp)>
update_handler_;
std::unique_ptr<NetworkControllerFactoryInterface> factory_;
std::unique_ptr<NetworkControllerInterface> controller_;
Timestamp current_time_ = Timestamp::MinusInfinity();
Timestamp last_process_ = Timestamp::MinusInfinity();
TransportFeedbackAdapter transport_feedback_;
std::deque<ProbingStatus> pending_probes_;
std::map<uint32_t, rtcp::ReportBlock> last_report_blocks_;
Timestamp last_report_block_time_ = Timestamp::MinusInfinity();
};
} // namespace webrtc
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_LOG_SIMULATION_H_

View File

@ -0,0 +1,600 @@
/*
* 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 <stdio.h>
#include <string.h>
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "absl/algorithm/container.h"
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"
#include "absl/flags/usage.h"
#include "absl/flags/usage_config.h"
#include "absl/strings/match.h"
#include "logging/rtc_event_log/rtc_event_log.h"
#include "logging/rtc_event_log/rtc_event_log_parser.h"
#include "modules/audio_coding/neteq/include/neteq.h"
#include "modules/rtp_rtcp/source/rtcp_packet/report_block.h"
#include "rtc_base/checks.h"
#include "rtc_tools/rtc_event_log_visualizer/analyzer.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h"
#include "rtc_tools/rtc_event_log_visualizer/plot_python.h"
#include "system_wrappers/include/field_trial.h"
#include "test/field_trial.h"
#include "test/testsupport/file_utils.h"
ABSL_FLAG(std::string,
plot,
"default",
"A comma separated list of plot names. See --list_plots for valid "
"options.");
ABSL_FLAG(
std::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 \"/\"");
ABSL_FLAG(std::string,
wav_filename,
"",
"Path to wav file used for simulation of jitter buffer");
ABSL_FLAG(bool,
show_detector_state,
false,
"Show the state of the delay based BWE detector on the total "
"bitrate graph");
ABSL_FLAG(bool,
show_alr_state,
false,
"Show the state ALR state on the total bitrate graph");
ABSL_FLAG(bool,
parse_unconfigured_header_extensions,
true,
"Attempt to parse unconfigured header extensions using the default "
"WebRTC mapping. This can give very misleading results if the "
"application negotiates a different mapping.");
ABSL_FLAG(bool,
print_triage_alerts,
false,
"Print triage alerts, i.e. a list of potential problems.");
ABSL_FLAG(bool,
normalize_time,
true,
"Normalize the log timestamps so that the call starts at time 0.");
ABSL_FLAG(bool,
shared_xaxis,
false,
"Share x-axis between all plots so that zooming in one plot "
"updates all the others too. A downside is that certain "
"operations like panning become much slower.");
ABSL_FLAG(bool,
protobuf_output,
false,
"Output charts as protobuf instead of python code.");
ABSL_FLAG(bool,
list_plots,
false,
"List of registered plots (for use with the --plot flag)");
using webrtc::Plot;
namespace {
std::vector<std::string> StrSplit(const std::string& s,
const std::string& delimiter) {
std::vector<std::string> v;
size_t pos = 0;
while (pos < s.length()) {
const std::string token = s.substr(pos, s.find(delimiter, pos) - pos);
pos += token.length() + delimiter.length();
v.push_back(token);
}
return v;
}
struct PlotDeclaration {
PlotDeclaration(const std::string& label, std::function<void(Plot*)> f)
: label(label), enabled(false), plot_func(f) {}
const std::string label;
bool enabled;
// TODO(terelius): Add a help text/explanation.
const std::function<void(Plot*)> plot_func;
};
class PlotMap {
public:
void RegisterPlot(const std::string& label, std::function<void(Plot*)> f) {
for (const auto& plot : plots_) {
RTC_DCHECK(plot.label != label)
<< "Can't use the same label for multiple plots";
}
plots_.push_back({label, f});
}
bool EnablePlotsByFlags(
const std::vector<std::string>& flags,
const std::map<std::string, std::vector<std::string>>& flag_aliases) {
bool status = true;
for (const std::string& flag : flags) {
auto alias_it = flag_aliases.find(flag);
if (alias_it != flag_aliases.end()) {
const auto& replacements = alias_it->second;
for (const auto& replacement : replacements) {
status &= EnablePlotByFlag(replacement);
}
} else {
status &= EnablePlotByFlag(flag);
}
}
return status;
}
void EnableAllPlots() {
for (auto& plot : plots_) {
plot.enabled = true;
}
}
std::vector<PlotDeclaration>::iterator begin() { return plots_.begin(); }
std::vector<PlotDeclaration>::iterator end() { return plots_.end(); }
private:
bool EnablePlotByFlag(const std::string& flag) {
for (auto& plot : plots_) {
if (plot.label == flag) {
plot.enabled = true;
return true;
}
}
if (flag == "simulated_neteq_jitter_buffer_delay") {
// This flag is handled separately.
return true;
}
std::cerr << "Unrecognized plot name \'" << flag << "\'. Aborting."
<< std::endl;
return false;
}
std::vector<PlotDeclaration> plots_;
};
bool ContainsHelppackageFlags(absl::string_view filename) {
return absl::EndsWith(filename, "main.cc");
}
} // namespace
int main(int argc, char* argv[]) {
absl::SetProgramUsageMessage(
"A tool for visualizing WebRTC event logs.\n"
"Example usage:\n"
"./event_log_visualizer <logfile> | python\n");
absl::FlagsUsageConfig config;
config.contains_help_flags = &ContainsHelppackageFlags;
absl::SetFlagsUsageConfig(config);
std::vector<char*> args = absl::ParseCommandLine(argc, argv);
// Flag replacements
std::map<std::string, std::vector<std::string>> flag_aliases = {
{"default",
{"incoming_delay", "incoming_loss_rate", "incoming_bitrate",
"outgoing_bitrate", "incoming_stream_bitrate",
"outgoing_stream_bitrate", "network_delay_feedback",
"fraction_loss_feedback"}},
{"sendside_bwe",
{"outgoing_packet_sizes", "outgoing_bitrate", "outgoing_stream_bitrate",
"simulated_sendside_bwe", "network_delay_feedback",
"fraction_loss_feedback"}},
{"receiveside_bwe",
{"incoming_packet_sizes", "incoming_delay", "incoming_loss_rate",
"incoming_bitrate", "incoming_stream_bitrate",
"simulated_receiveside_bwe"}},
{"rtcp_details",
{"incoming_rtcp_fraction_lost", "outgoing_rtcp_fraction_lost",
"incoming_rtcp_cumulative_lost", "outgoing_rtcp_cumulative_lost",
"incoming_rtcp_highest_seq_number", "outgoing_rtcp_highest_seq_number",
"incoming_rtcp_delay_since_last_sr",
"outgoing_rtcp_delay_since_last_sr"}},
{"simulated_neteq_stats",
{"simulated_neteq_jitter_buffer_delay",
"simulated_neteq_preferred_buffer_size",
"simulated_neteq_concealment_events",
"simulated_neteq_packet_loss_rate", "simulated_neteq_preemptive_rate",
"simulated_neteq_accelerate_rate", "simulated_neteq_speech_expand_rate",
"simulated_neteq_expand_rate"}}};
std::vector<std::string> plot_flags =
StrSplit(absl::GetFlag(FLAGS_plot), ",");
// InitFieldTrialsFromString stores the char*, so the char array must outlive
// the application.
const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials);
webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str());
webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions header_extensions =
webrtc::ParsedRtcEventLog::UnconfiguredHeaderExtensions::kDontParse;
if (absl::GetFlag(FLAGS_parse_unconfigured_header_extensions)) {
header_extensions = webrtc::ParsedRtcEventLog::
UnconfiguredHeaderExtensions::kAttemptWebrtcDefaultConfig;
}
webrtc::ParsedRtcEventLog parsed_log(header_extensions);
if (args.size() == 2) {
std::string filename = args[1];
if (!parsed_log.ParseFile(filename)) {
std::cerr << "Could not parse the entire log file." << std::endl;
std::cerr << "Only the parsable events will be analyzed." << std::endl;
}
}
webrtc::EventLogAnalyzer analyzer(parsed_log,
absl::GetFlag(FLAGS_normalize_time));
std::unique_ptr<webrtc::PlotCollection> collection;
if (absl::GetFlag(FLAGS_protobuf_output)) {
collection.reset(new webrtc::ProtobufPlotCollection());
} else {
collection.reset(
new webrtc::PythonPlotCollection(absl::GetFlag(FLAGS_shared_xaxis)));
}
PlotMap plots;
plots.RegisterPlot("incoming_packet_sizes", [&](Plot* plot) {
analyzer.CreatePacketGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_packet_sizes", [&](Plot* plot) {
analyzer.CreatePacketGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("incoming_rtcp_types", [&](Plot* plot) {
analyzer.CreateRtcpTypeGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_rtcp_types", [&](Plot* plot) {
analyzer.CreateRtcpTypeGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("incoming_packet_count", [&](Plot* plot) {
analyzer.CreateAccumulatedPacketsGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_packet_count", [&](Plot* plot) {
analyzer.CreateAccumulatedPacketsGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("audio_playout",
[&](Plot* plot) { analyzer.CreatePlayoutGraph(plot); });
plots.RegisterPlot("incoming_audio_level", [&](Plot* plot) {
analyzer.CreateAudioLevelGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_audio_level", [&](Plot* plot) {
analyzer.CreateAudioLevelGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("incoming_sequence_number_delta", [&](Plot* plot) {
analyzer.CreateSequenceNumberGraph(plot);
});
plots.RegisterPlot("incoming_delay", [&](Plot* plot) {
analyzer.CreateIncomingDelayGraph(plot);
});
plots.RegisterPlot("incoming_loss_rate", [&](Plot* plot) {
analyzer.CreateIncomingPacketLossGraph(plot);
});
plots.RegisterPlot("incoming_bitrate", [&](Plot* plot) {
analyzer.CreateTotalIncomingBitrateGraph(plot);
});
plots.RegisterPlot("outgoing_bitrate", [&](Plot* plot) {
analyzer.CreateTotalOutgoingBitrateGraph(
plot, absl::GetFlag(FLAGS_show_detector_state),
absl::GetFlag(FLAGS_show_alr_state));
});
plots.RegisterPlot("incoming_stream_bitrate", [&](Plot* plot) {
analyzer.CreateStreamBitrateGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_stream_bitrate", [&](Plot* plot) {
analyzer.CreateStreamBitrateGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("incoming_layer_bitrate_allocation", [&](Plot* plot) {
analyzer.CreateBitrateAllocationGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_layer_bitrate_allocation", [&](Plot* plot) {
analyzer.CreateBitrateAllocationGraph(webrtc::kOutgoingPacket, plot);
});
plots.RegisterPlot("simulated_receiveside_bwe", [&](Plot* plot) {
analyzer.CreateReceiveSideBweSimulationGraph(plot);
});
plots.RegisterPlot("simulated_sendside_bwe", [&](Plot* plot) {
analyzer.CreateSendSideBweSimulationGraph(plot);
});
plots.RegisterPlot("simulated_goog_cc", [&](Plot* plot) {
analyzer.CreateGoogCcSimulationGraph(plot);
});
plots.RegisterPlot("network_delay_feedback", [&](Plot* plot) {
analyzer.CreateNetworkDelayFeedbackGraph(plot);
});
plots.RegisterPlot("fraction_loss_feedback", [&](Plot* plot) {
analyzer.CreateFractionLossGraph(plot);
});
plots.RegisterPlot("incoming_timestamps", [&](Plot* plot) {
analyzer.CreateTimestampGraph(webrtc::kIncomingPacket, plot);
});
plots.RegisterPlot("outgoing_timestamps", [&](Plot* plot) {
analyzer.CreateTimestampGraph(webrtc::kOutgoingPacket, plot);
});
auto GetFractionLost = [](const webrtc::rtcp::ReportBlock& block) -> float {
return static_cast<double>(block.fraction_lost()) / 256 * 100;
};
plots.RegisterPlot("incoming_rtcp_fraction_lost", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kIncomingPacket, GetFractionLost,
"Fraction lost (incoming RTCP)", "Loss rate (percent)", plot);
});
plots.RegisterPlot("outgoing_rtcp_fraction_lost", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kOutgoingPacket, GetFractionLost,
"Fraction lost (outgoing RTCP)", "Loss rate (percent)", plot);
});
auto GetCumulativeLost = [](const webrtc::rtcp::ReportBlock& block) -> float {
return block.cumulative_lost_signed();
};
plots.RegisterPlot("incoming_rtcp_cumulative_lost", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kIncomingPacket, GetCumulativeLost,
"Cumulative lost packets (incoming RTCP)", "Packets", plot);
});
plots.RegisterPlot("outgoing_rtcp_cumulative_lost", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kOutgoingPacket, GetCumulativeLost,
"Cumulative lost packets (outgoing RTCP)", "Packets", plot);
});
auto GetHighestSeqNumber =
[](const webrtc::rtcp::ReportBlock& block) -> float {
return block.extended_high_seq_num();
};
plots.RegisterPlot("incoming_rtcp_highest_seq_number", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kIncomingPacket, GetHighestSeqNumber,
"Highest sequence number (incoming RTCP)", "Sequence number", plot);
});
plots.RegisterPlot("outgoing_rtcp_highest_seq_number", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kOutgoingPacket, GetHighestSeqNumber,
"Highest sequence number (outgoing RTCP)", "Sequence number", plot);
});
auto DelaySinceLastSr = [](const webrtc::rtcp::ReportBlock& block) -> float {
return static_cast<double>(block.delay_since_last_sr()) / 65536;
};
plots.RegisterPlot("incoming_rtcp_delay_since_last_sr", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kIncomingPacket, DelaySinceLastSr,
"Delay since last received sender report (incoming RTCP)", "Time (s)",
plot);
});
plots.RegisterPlot("outgoing_rtcp_delay_since_last_sr", [&](Plot* plot) {
analyzer.CreateSenderAndReceiverReportPlot(
webrtc::kOutgoingPacket, DelaySinceLastSr,
"Delay since last received sender report (outgoing RTCP)", "Time (s)",
plot);
});
plots.RegisterPlot("pacer_delay",
[&](Plot* plot) { analyzer.CreatePacerDelayGraph(plot); });
plots.RegisterPlot("audio_encoder_bitrate", [&](Plot* plot) {
analyzer.CreateAudioEncoderTargetBitrateGraph(plot);
});
plots.RegisterPlot("audio_encoder_frame_length", [&](Plot* plot) {
analyzer.CreateAudioEncoderFrameLengthGraph(plot);
});
plots.RegisterPlot("audio_encoder_packet_loss", [&](Plot* plot) {
analyzer.CreateAudioEncoderPacketLossGraph(plot);
});
plots.RegisterPlot("audio_encoder_fec", [&](Plot* plot) {
analyzer.CreateAudioEncoderEnableFecGraph(plot);
});
plots.RegisterPlot("audio_encoder_dtx", [&](Plot* plot) {
analyzer.CreateAudioEncoderEnableDtxGraph(plot);
});
plots.RegisterPlot("audio_encoder_num_channels", [&](Plot* plot) {
analyzer.CreateAudioEncoderNumChannelsGraph(plot);
});
plots.RegisterPlot("ice_candidate_pair_config", [&](Plot* plot) {
analyzer.CreateIceCandidatePairConfigGraph(plot);
});
plots.RegisterPlot("ice_connectivity_check", [&](Plot* plot) {
analyzer.CreateIceConnectivityCheckGraph(plot);
});
plots.RegisterPlot("dtls_transport_state", [&](Plot* plot) {
analyzer.CreateDtlsTransportStateGraph(plot);
});
plots.RegisterPlot("dtls_writable_state", [&](Plot* plot) {
analyzer.CreateDtlsWritableStateGraph(plot);
});
std::string wav_path;
if (!absl::GetFlag(FLAGS_wav_filename).empty()) {
wav_path = absl::GetFlag(FLAGS_wav_filename);
} else {
wav_path = webrtc::test::ResourcePath(
"audio_processing/conversational_speech/EN_script2_F_sp2_B1", "wav");
}
absl::optional<webrtc::EventLogAnalyzer::NetEqStatsGetterMap> neteq_stats;
plots.RegisterPlot("simulated_neteq_expand_rate", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqNetworkStatsGraph(
*neteq_stats,
[](const webrtc::NetEqNetworkStatistics& stats) {
return stats.expand_rate / 16384.f;
},
"Expand rate", plot);
});
plots.RegisterPlot("simulated_neteq_speech_expand_rate", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqNetworkStatsGraph(
*neteq_stats,
[](const webrtc::NetEqNetworkStatistics& stats) {
return stats.speech_expand_rate / 16384.f;
},
"Speech expand rate", plot);
});
plots.RegisterPlot("simulated_neteq_accelerate_rate", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqNetworkStatsGraph(
*neteq_stats,
[](const webrtc::NetEqNetworkStatistics& stats) {
return stats.accelerate_rate / 16384.f;
},
"Accelerate rate", plot);
});
plots.RegisterPlot("simulated_neteq_preemptive_rate", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqNetworkStatsGraph(
*neteq_stats,
[](const webrtc::NetEqNetworkStatistics& stats) {
return stats.preemptive_rate / 16384.f;
},
"Preemptive rate", plot);
});
plots.RegisterPlot("simulated_neteq_packet_loss_rate", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqNetworkStatsGraph(
*neteq_stats,
[](const webrtc::NetEqNetworkStatistics& stats) {
return stats.packet_loss_rate / 16384.f;
},
"Packet loss rate", plot);
});
plots.RegisterPlot("simulated_neteq_concealment_events", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqLifetimeStatsGraph(
*neteq_stats,
[](const webrtc::NetEqLifetimeStatistics& stats) {
return static_cast<float>(stats.concealment_events);
},
"Concealment events", plot);
});
plots.RegisterPlot("simulated_neteq_preferred_buffer_size", [&](Plot* plot) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
analyzer.CreateNetEqNetworkStatsGraph(
*neteq_stats,
[](const webrtc::NetEqNetworkStatistics& stats) {
return stats.preferred_buffer_size_ms;
},
"Preferred buffer size (ms)", plot);
});
if (absl::c_find(plot_flags, "all") != plot_flags.end()) {
plots.EnableAllPlots();
// Treated separately since it isn't registered like the other plots.
plot_flags.push_back("simulated_neteq_jitter_buffer_delay");
} else {
bool success = plots.EnablePlotsByFlags(plot_flags, flag_aliases);
if (!success) {
return 1;
}
}
if (absl::GetFlag(FLAGS_list_plots)) {
std::cerr << "List of registered plots (for use with the --plot flag):"
<< std::endl;
for (const auto& plot : plots) {
// TODO(terelius): Also print a help text.
std::cerr << " " << plot.label << std::endl;
}
// The following flag doesn't fit the model used for the other plots.
std::cerr << "simulated_neteq_jitter_buffer_delay" << std::endl;
std::cerr << "List of plot aliases (for use with the --plot flag):"
<< std::endl;
std::cerr << " all = every registered plot" << std::endl;
for (const auto& alias : flag_aliases) {
std::cerr << " " << alias.first << " = ";
for (const auto& replacement : alias.second) {
std::cerr << replacement << ",";
}
std::cerr << std::endl;
}
return 0;
}
if (args.size() != 2) {
// Print usage information.
std::cerr << absl::ProgramUsageMessage();
return 1;
}
for (const auto& plot : plots) {
if (plot.enabled) {
Plot* output = collection->AppendNewPlot();
plot.plot_func(output);
output->SetId(plot.label);
}
}
// The model we use for registering plots assumes that the each plot label
// can be mapped to a lambda that will produce exactly one plot. The
// simulated_neteq_jitter_buffer_delay plot doesn't fit this model since it
// creates multiple plots, and would need some state kept between the lambda
// calls.
if (absl::c_find(plot_flags, "simulated_neteq_jitter_buffer_delay") !=
plot_flags.end()) {
if (!neteq_stats) {
neteq_stats = analyzer.SimulateNetEq(wav_path, 48000);
}
for (webrtc::EventLogAnalyzer::NetEqStatsGetterMap::const_iterator it =
neteq_stats->cbegin();
it != neteq_stats->cend(); ++it) {
analyzer.CreateAudioJitterBufferGraph(it->first, it->second.get(),
collection->AppendNewPlot());
}
}
collection->Draw();
if (absl::GetFlag(FLAGS_print_triage_alerts)) {
analyzer.CreateTriageNotifications();
analyzer.PrintNotifications(stderr);
}
return 0;
}

View File

@ -0,0 +1,96 @@
/*
* 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 "rtc_tools/rtc_event_log_visualizer/plot_base.h"
#include <algorithm>
#include "rtc_base/checks.h"
namespace webrtc {
void Plot::SetXAxis(float min_value,
float max_value,
std::string label,
float left_margin,
float right_margin) {
RTC_DCHECK_LE(min_value, max_value);
xaxis_min_ = min_value - left_margin * (max_value - min_value);
xaxis_max_ = max_value + right_margin * (max_value - min_value);
xaxis_label_ = label;
}
void Plot::SetSuggestedXAxis(float min_value,
float max_value,
std::string label,
float left_margin,
float right_margin) {
for (const auto& series : series_list_) {
for (const auto& point : series.points) {
min_value = std::min(min_value, point.x);
max_value = std::max(max_value, point.x);
}
}
SetXAxis(min_value, max_value, label, left_margin, right_margin);
}
void Plot::SetYAxis(float min_value,
float max_value,
std::string label,
float bottom_margin,
float top_margin) {
RTC_DCHECK_LE(min_value, max_value);
yaxis_min_ = min_value - bottom_margin * (max_value - min_value);
yaxis_max_ = max_value + top_margin * (max_value - min_value);
yaxis_label_ = label;
}
void Plot::SetSuggestedYAxis(float min_value,
float max_value,
std::string label,
float bottom_margin,
float top_margin) {
for (const auto& series : series_list_) {
for (const auto& point : series.points) {
min_value = std::min(min_value, point.y);
max_value = std::max(max_value, point.y);
}
}
SetYAxis(min_value, max_value, label, bottom_margin, top_margin);
}
void Plot::SetYAxisTickLabels(
const std::vector<std::pair<float, std::string>>& labels) {
yaxis_tick_labels_ = labels;
}
void Plot::SetTitle(const std::string& title) {
title_ = title;
}
void Plot::SetId(const std::string& id) {
id_ = id;
}
void Plot::AppendTimeSeries(TimeSeries&& time_series) {
series_list_.emplace_back(std::move(time_series));
}
void Plot::AppendIntervalSeries(IntervalSeries&& interval_series) {
interval_list_.emplace_back(std::move(interval_series));
}
void Plot::AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series) {
if (time_series.points.size() > 0) {
series_list_.emplace_back(std::move(time_series));
}
}
} // namespace webrtc

View File

@ -0,0 +1,187 @@
/*
* 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.
*/
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_BASE_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_BASE_H_
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace webrtc {
enum class LineStyle {
kNone, // No line connecting the points. Used to create scatter plots.
kLine, // Straight line between consecutive points.
kStep, // Horizontal line until the next value. Used for state changes.
kBar // Vertical bars from the x-axis to the point.
};
enum class PointStyle {
kNone, // Don't draw the points.
kHighlight // Draw circles or dots to highlight the points.
};
struct TimeSeriesPoint {
TimeSeriesPoint(float x, float y) : x(x), y(y) {}
float x;
float y;
};
struct TimeSeries {
TimeSeries() = default; // TODO(terelius): Remove the default constructor.
TimeSeries(const char* label,
LineStyle line_style,
PointStyle point_style = PointStyle::kNone)
: label(label), line_style(line_style), point_style(point_style) {}
TimeSeries(const std::string& label,
LineStyle line_style,
PointStyle point_style = PointStyle::kNone)
: label(label), line_style(line_style), point_style(point_style) {}
TimeSeries(TimeSeries&& other)
: label(std::move(other.label)),
line_style(other.line_style),
point_style(other.point_style),
points(std::move(other.points)) {}
TimeSeries& operator=(TimeSeries&& other) {
label = std::move(other.label);
line_style = other.line_style;
point_style = other.point_style;
points = std::move(other.points);
return *this;
}
std::string label;
LineStyle line_style = LineStyle::kLine;
PointStyle point_style = PointStyle::kNone;
std::vector<TimeSeriesPoint> points;
};
struct Interval {
Interval() = default;
Interval(double begin, double end) : begin(begin), end(end) {}
double begin;
double end;
};
struct IntervalSeries {
enum Orientation { kHorizontal, kVertical };
IntervalSeries() = default;
IntervalSeries(const std::string& label,
const std::string& color,
IntervalSeries::Orientation orientation)
: label(label), color(color), orientation(orientation) {}
std::string label;
std::string color;
Orientation orientation;
std::vector<Interval> intervals;
};
// A container that represents a general graph, with axes, title and one or
// more data series. A subclass should define the output format by overriding
// the Draw() method.
class Plot {
public:
virtual ~Plot() {}
// Overloaded to draw the plot.
virtual void Draw() = 0;
// Sets the lower x-axis limit to min_value (if left_margin == 0).
// Sets the upper x-axis limit to max_value (if right_margin == 0).
// The margins are measured as fractions of the interval
// (max_value - min_value) and are added to either side of the plot.
void SetXAxis(float min_value,
float max_value,
std::string label,
float left_margin = 0,
float right_margin = 0);
// Sets the lower and upper x-axis limits based on min_value and max_value,
// but modified such that all points in the data series can be represented
// on the x-axis. The margins are measured as fractions of the range of
// x-values and are added to either side of the plot.
void SetSuggestedXAxis(float min_value,
float max_value,
std::string label,
float left_margin = 0,
float right_margin = 0);
// Sets the lower y-axis limit to min_value (if bottom_margin == 0).
// Sets the upper y-axis limit to max_value (if top_margin == 0).
// The margins are measured as fractions of the interval
// (max_value - min_value) and are added to either side of the plot.
void SetYAxis(float min_value,
float max_value,
std::string label,
float bottom_margin = 0,
float top_margin = 0);
// Sets the lower and upper y-axis limits based on min_value and max_value,
// but modified such that all points in the data series can be represented
// on the y-axis. The margins are measured as fractions of the range of
// y-values and are added to either side of the plot.
void SetSuggestedYAxis(float min_value,
float max_value,
std::string label,
float bottom_margin = 0,
float top_margin = 0);
void SetYAxisTickLabels(
const std::vector<std::pair<float, std::string>>& labels);
// Sets the title of the plot.
void SetTitle(const std::string& title);
// Sets an unique ID for the plot. The ID is similar to the title except that
// the title might change in future releases whereas the ID should be stable
// over time.
void SetId(const std::string& id);
// Add a new TimeSeries to the plot.
void AppendTimeSeries(TimeSeries&& time_series);
// Add a new IntervalSeries to the plot.
void AppendIntervalSeries(IntervalSeries&& interval_series);
// Add a new TimeSeries to the plot if the series contains contains data.
// Otherwise, the call has no effect and the timeseries is destroyed.
void AppendTimeSeriesIfNotEmpty(TimeSeries&& time_series);
protected:
float xaxis_min_;
float xaxis_max_;
std::string xaxis_label_;
float yaxis_min_;
float yaxis_max_;
std::string yaxis_label_;
std::vector<std::pair<float, std::string>> yaxis_tick_labels_;
std::string title_;
std::string id_;
std::vector<TimeSeries> series_list_;
std::vector<IntervalSeries> interval_list_;
};
class PlotCollection {
public:
virtual ~PlotCollection() {}
virtual void Draw() = 0;
virtual Plot* AppendNewPlot() = 0;
protected:
std::vector<std::unique_ptr<Plot>> plots_;
};
} // namespace webrtc
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_BASE_H_

View File

@ -0,0 +1,100 @@
/*
* 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 "rtc_tools/rtc_event_log_visualizer/plot_protobuf.h"
#include <stddef.h>
#include <iostream>
#include <memory>
#include <vector>
namespace webrtc {
ProtobufPlot::ProtobufPlot() {}
ProtobufPlot::~ProtobufPlot() {}
void ProtobufPlot::Draw() {}
void ProtobufPlot::ExportProtobuf(webrtc::analytics::Chart* chart) {
for (size_t i = 0; i < series_list_.size(); i++) {
webrtc::analytics::DataSet* data_set = chart->add_data_sets();
for (const auto& point : series_list_[i].points) {
data_set->add_x_values(point.x);
}
for (const auto& point : series_list_[i].points) {
data_set->add_y_values(point.y);
}
if (series_list_[i].line_style == LineStyle::kBar) {
data_set->set_style(webrtc::analytics::ChartStyle::BAR_CHART);
} else if (series_list_[i].line_style == LineStyle::kLine) {
data_set->set_style(webrtc::analytics::ChartStyle::LINE_CHART);
} else if (series_list_[i].line_style == LineStyle::kStep) {
data_set->set_style(webrtc::analytics::ChartStyle::LINE_STEP_CHART);
} else if (series_list_[i].line_style == LineStyle::kNone) {
data_set->set_style(webrtc::analytics::ChartStyle::SCATTER_CHART);
} else {
data_set->set_style(webrtc::analytics::ChartStyle::UNDEFINED);
}
if (series_list_[i].point_style == PointStyle::kHighlight)
data_set->set_highlight_points(true);
data_set->set_label(series_list_[i].label);
}
chart->set_xaxis_min(xaxis_min_);
chart->set_xaxis_max(xaxis_max_);
chart->set_yaxis_min(yaxis_min_);
chart->set_yaxis_max(yaxis_max_);
chart->set_xaxis_label(xaxis_label_);
chart->set_yaxis_label(yaxis_label_);
chart->set_title(title_);
chart->set_id(id_);
for (const auto& kv : yaxis_tick_labels_) {
webrtc::analytics::TickLabel* tick = chart->add_yaxis_tick_labels();
tick->set_value(kv.first);
tick->set_label(kv.second);
}
}
ProtobufPlotCollection::ProtobufPlotCollection() {}
ProtobufPlotCollection::~ProtobufPlotCollection() {}
void ProtobufPlotCollection::Draw() {
webrtc::analytics::ChartCollection collection;
ExportProtobuf(&collection);
std::cout << collection.SerializeAsString();
}
void ProtobufPlotCollection::ExportProtobuf(
webrtc::analytics::ChartCollection* collection) {
for (const auto& plot : plots_) {
// TODO(terelius): Ensure that there is no way to insert plots other than
// ProtobufPlots in a ProtobufPlotCollection. Needed to safely static_cast
// here.
webrtc::analytics::Chart* protobuf_representation =
collection->add_charts();
static_cast<ProtobufPlot*>(plot.get())
->ExportProtobuf(protobuf_representation);
}
}
Plot* ProtobufPlotCollection::AppendNewPlot() {
Plot* plot = new ProtobufPlot();
plots_.push_back(std::unique_ptr<Plot>(plot));
return plot;
}
} // namespace webrtc

View File

@ -0,0 +1,40 @@
/*
* 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.
*/
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_
#include "rtc_base/ignore_wundef.h"
RTC_PUSH_IGNORING_WUNDEF()
#include "rtc_tools/rtc_event_log_visualizer/proto/chart.pb.h"
RTC_POP_IGNORING_WUNDEF()
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
namespace webrtc {
class ProtobufPlot final : public Plot {
public:
ProtobufPlot();
~ProtobufPlot() override;
void Draw() override;
void ExportProtobuf(webrtc::analytics::Chart* chart);
};
class ProtobufPlotCollection final : public PlotCollection {
public:
ProtobufPlotCollection();
~ProtobufPlotCollection() override;
void Draw() override;
Plot* AppendNewPlot() override;
void ExportProtobuf(webrtc::analytics::ChartCollection* collection);
};
} // namespace webrtc
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PROTOBUF_H_

View File

@ -0,0 +1,205 @@
/*
* 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 "rtc_tools/rtc_event_log_visualizer/plot_python.h"
#include <stdio.h>
#include <memory>
#include <string>
#include <vector>
#include "rtc_base/checks.h"
namespace webrtc {
PythonPlot::PythonPlot() {}
PythonPlot::~PythonPlot() {}
void PythonPlot::Draw() {
// Write python commands to stdout. Intended program usage is
// ./event_log_visualizer event_log160330.dump | python
if (!series_list_.empty()) {
printf("color_count = %zu\n", series_list_.size());
printf(
"hls_colors = [(i*1.0/color_count, 0.25+i*0.5/color_count, 0.8) for i "
"in range(color_count)]\n");
printf("colors = [colorsys.hls_to_rgb(*hls) for hls in hls_colors]\n");
for (size_t i = 0; i < series_list_.size(); i++) {
printf("\n# === Series: %s ===\n", series_list_[i].label.c_str());
// List x coordinates
printf("x%zu = [", i);
if (series_list_[i].points.size() > 0)
printf("%.3f", series_list_[i].points[0].x);
for (size_t j = 1; j < series_list_[i].points.size(); j++)
printf(", %.3f", series_list_[i].points[j].x);
printf("]\n");
// List y coordinates
printf("y%zu = [", i);
if (series_list_[i].points.size() > 0)
printf("%G", series_list_[i].points[0].y);
for (size_t j = 1; j < series_list_[i].points.size(); j++)
printf(", %G", series_list_[i].points[j].y);
printf("]\n");
if (series_list_[i].line_style == LineStyle::kBar) {
// There is a plt.bar function that draws bar plots,
// but it is *way* too slow to be useful.
printf(
"plt.vlines(x%zu, map(lambda t: min(t,0), y%zu), map(lambda t: "
"max(t,0), y%zu), color=colors[%zu], "
"label=\'%s\')\n",
i, i, i, i, series_list_[i].label.c_str());
if (series_list_[i].point_style == PointStyle::kHighlight) {
printf(
"plt.plot(x%zu, y%zu, color=colors[%zu], "
"marker='.', ls=' ')\n",
i, i, i);
}
} else if (series_list_[i].line_style == LineStyle::kLine) {
if (series_list_[i].point_style == PointStyle::kHighlight) {
printf(
"plt.plot(x%zu, y%zu, color=colors[%zu], label=\'%s\', "
"marker='.')\n",
i, i, i, series_list_[i].label.c_str());
} else {
printf("plt.plot(x%zu, y%zu, color=colors[%zu], label=\'%s\')\n", i,
i, i, series_list_[i].label.c_str());
}
} else if (series_list_[i].line_style == LineStyle::kStep) {
// Draw lines from (x[0],y[0]) to (x[1],y[0]) to (x[1],y[1]) and so on
// to illustrate the "steps". This can be expressed by duplicating all
// elements except the first in x and the last in y.
printf("xd%zu = [dup for v in x%zu for dup in [v, v]]\n", i, i);
printf("yd%zu = [dup for v in y%zu for dup in [v, v]]\n", i, i);
printf(
"plt.plot(xd%zu[1:], yd%zu[:-1], color=colors[%zu], "
"label=\'%s\')\n",
i, i, i, series_list_[i].label.c_str());
if (series_list_[i].point_style == PointStyle::kHighlight) {
printf(
"plt.plot(x%zu, y%zu, color=colors[%zu], "
"marker='.', ls=' ')\n",
i, i, i);
}
} else if (series_list_[i].line_style == LineStyle::kNone) {
printf(
"plt.plot(x%zu, y%zu, color=colors[%zu], label=\'%s\', "
"marker='o', ls=' ')\n",
i, i, i, series_list_[i].label.c_str());
} else {
printf("raise Exception(\"Unknown graph type\")\n");
}
}
// IntervalSeries
printf("interval_colors = ['#ff8e82','#5092fc','#c4ffc4','#aaaaaa']\n");
RTC_CHECK_LE(interval_list_.size(), 4);
// To get the intervals to show up in the legend we have to create patches
// for them.
printf("legend_patches = []\n");
for (size_t i = 0; i < interval_list_.size(); i++) {
// List intervals
printf("\n# === IntervalSeries: %s ===\n",
interval_list_[i].label.c_str());
printf("ival%zu = [", i);
if (interval_list_[i].intervals.size() > 0) {
printf("(%G, %G)", interval_list_[i].intervals[0].begin,
interval_list_[i].intervals[0].end);
}
for (size_t j = 1; j < interval_list_[i].intervals.size(); j++) {
printf(", (%G, %G)", interval_list_[i].intervals[j].begin,
interval_list_[i].intervals[j].end);
}
printf("]\n");
printf("for i in range(0, %zu):\n", interval_list_[i].intervals.size());
if (interval_list_[i].orientation == IntervalSeries::kVertical) {
printf(
" plt.axhspan(ival%zu[i][0], ival%zu[i][1], "
"facecolor=interval_colors[%zu], "
"alpha=0.3)\n",
i, i, i);
} else {
printf(
" plt.axvspan(ival%zu[i][0], ival%zu[i][1], "
"facecolor=interval_colors[%zu], "
"alpha=0.3)\n",
i, i, i);
}
printf(
"legend_patches.append(mpatches.Patch(ec=\'black\', "
"fc=interval_colors[%zu], label='%s'))\n",
i, interval_list_[i].label.c_str());
}
}
printf("plt.xlim(%f, %f)\n", xaxis_min_, xaxis_max_);
printf("plt.ylim(%f, %f)\n", yaxis_min_, yaxis_max_);
printf("plt.xlabel(\'%s\')\n", xaxis_label_.c_str());
printf("plt.ylabel(\'%s\')\n", yaxis_label_.c_str());
printf("plt.title(\'%s\')\n", title_.c_str());
printf("fig = plt.gcf()\n");
printf("fig.canvas.set_window_title(\'%s\')\n", id_.c_str());
if (!yaxis_tick_labels_.empty()) {
printf("yaxis_tick_labels = [");
for (const auto& kv : yaxis_tick_labels_) {
printf("(%f,\"%s\"),", kv.first, kv.second.c_str());
}
printf("]\n");
printf("yaxis_tick_labels = list(zip(*yaxis_tick_labels))\n");
printf("plt.yticks(*yaxis_tick_labels)\n");
}
if (!series_list_.empty() || !interval_list_.empty()) {
printf("handles, labels = plt.gca().get_legend_handles_labels()\n");
printf("for lp in legend_patches:\n");
printf(" handles.append(lp)\n");
printf(" labels.append(lp.get_label())\n");
printf("plt.legend(handles, labels, loc=\'best\', fontsize=\'small\')\n");
}
}
PythonPlotCollection::PythonPlotCollection(bool shared_xaxis)
: shared_xaxis_(shared_xaxis) {}
PythonPlotCollection::~PythonPlotCollection() {}
void PythonPlotCollection::Draw() {
printf("import matplotlib.pyplot as plt\n");
printf("plt.rcParams.update({'figure.max_open_warning': 0})\n");
printf("import matplotlib.patches as mpatches\n");
printf("import matplotlib.patheffects as pe\n");
printf("import colorsys\n");
for (size_t i = 0; i < plots_.size(); i++) {
printf("plt.figure(%zu)\n", i);
if (shared_xaxis_) {
// Link x-axes across all figures for synchronized zooming.
if (i == 0) {
printf("axis0 = plt.subplot(111)\n");
} else {
printf("plt.subplot(111, sharex=axis0)\n");
}
}
plots_[i]->Draw();
}
printf("plt.show()\n");
}
Plot* PythonPlotCollection::AppendNewPlot() {
Plot* plot = new PythonPlot();
plots_.push_back(std::unique_ptr<Plot>(plot));
return plot;
}
} // namespace webrtc

View File

@ -0,0 +1,37 @@
/*
* 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.
*/
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
namespace webrtc {
class PythonPlot final : public Plot {
public:
PythonPlot();
~PythonPlot() override;
void Draw() override;
};
class PythonPlotCollection final : public PlotCollection {
public:
explicit PythonPlotCollection(bool shared_xaxis = false);
~PythonPlotCollection() override;
void Draw() override;
Plot* AppendNewPlot() override;
private:
bool shared_xaxis_;
};
} // namespace webrtc
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_PLOT_PYTHON_H_

View File

@ -0,0 +1,36 @@
syntax = "proto3";
// Describes a chart generated from WebRTC event log data.
option optimize_for = LITE_RUNTIME;
package webrtc.analytics;
import "chart_enums.proto";
message DataSet {
repeated float x_values = 1;
repeated float y_values = 2;
string label = 3;
ChartStyle.Type style = 4;
bool highlight_points = 5;
}
message TickLabel {
float value = 1;
string label = 2;
}
message Chart {
repeated DataSet data_sets = 1;
float xaxis_min = 2;
float xaxis_max = 3;
string xaxis_label = 4;
float yaxis_min = 5;
float yaxis_max = 6;
string yaxis_label = 7;
string title = 8;
string id = 9;
repeated TickLabel yaxis_tick_labels = 10;
}
message ChartCollection {
repeated Chart charts = 1;
}

View File

@ -0,0 +1,13 @@
syntax = "proto3";
// Contains enums used as part of chart.proto
package webrtc.analytics;
message ChartStyle {
enum Type {
UNDEFINED = 0;
LINE_CHART = 1;
BAR_CHART = 2;
LINE_STEP_CHART = 3;
SCATTER_CHART = 4;
};
};

View File

@ -0,0 +1,158 @@
/*
* Copyright (c) 2017 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.
*/
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_
#include <string>
namespace webrtc {
class IncomingRtpReceiveTimeGap {
public:
IncomingRtpReceiveTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("No RTP packets received for ") +
std::to_string(duration_) + std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class IncomingRtcpReceiveTimeGap {
public:
IncomingRtcpReceiveTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("No RTCP packets received for ") +
std::to_string(duration_) + std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class OutgoingRtpSendTimeGap {
public:
OutgoingRtpSendTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("No RTP packets sent for ") + std::to_string(duration_) +
std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class OutgoingRtcpSendTimeGap {
public:
OutgoingRtcpSendTimeGap(float time_seconds, int64_t duration)
: time_seconds_(time_seconds), duration_(duration) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("No RTCP packets sent for ") +
std::to_string(duration_) + std::string(" ms");
}
private:
float time_seconds_;
int64_t duration_;
};
class IncomingSeqNumJump {
public:
IncomingSeqNumJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("Sequence number jumps on incoming SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class IncomingCaptureTimeJump {
public:
IncomingCaptureTimeJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("Capture timestamp jumps on incoming SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class OutgoingSeqNoJump {
public:
OutgoingSeqNoJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("Sequence number jumps on outgoing SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class OutgoingCaptureTimeJump {
public:
OutgoingCaptureTimeJump(float time_seconds, uint32_t ssrc)
: time_seconds_(time_seconds), ssrc_(ssrc) {}
float Time() const { return time_seconds_; }
std::string ToString() const {
return std::string("Capture timestamp jumps on outgoing SSRC ") +
std::to_string(ssrc_);
}
private:
float time_seconds_;
uint32_t ssrc_;
};
class OutgoingHighLoss {
public:
explicit OutgoingHighLoss(double avg_loss_fraction)
: avg_loss_fraction_(avg_loss_fraction) {}
std::string ToString() const {
return std::string("High average loss (") +
std::to_string(avg_loss_fraction_ * 100) +
std::string("%) across the call.");
}
private:
double avg_loss_fraction_;
};
} // namespace webrtc
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_TRIAGE_NOTIFICATIONS_H_