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.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-07-25 13:57:41 +02:00
|
|
|
#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
|
|
|
|
|
#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2016-07-19 01:51:06 -07:00
|
|
|
#include <map>
|
2016-07-29 14:48:54 +02:00
|
|
|
#include <memory>
|
2016-08-08 10:21:04 -07:00
|
|
|
#include <set>
|
2016-09-05 02:46:25 -07:00
|
|
|
#include <string>
|
2016-07-29 14:48:54 +02:00
|
|
|
#include <utility>
|
2016-09-05 02:46:25 -07:00
|
|
|
#include <vector>
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2019-01-03 14:46:23 +01:00
|
|
|
#include "logging/rtc_event_log/rtc_event_log_parser.h"
|
2018-05-04 09:46:44 +02:00
|
|
|
#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
|
2018-04-27 14:33:34 +02:00
|
|
|
#include "rtc_base/strings/string_builder.h"
|
2019-07-25 13:57:41 +02:00
|
|
|
#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
|
|
|
|
|
#include "rtc_tools/rtc_event_log_visualizer/triage_notifications.h"
|
2016-07-13 06:44:41 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2017-02-22 07:33:27 -08:00
|
|
|
|
2019-02-13 22:38:25 +01:00
|
|
|
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.
|
2019-07-25 11:55:47 +02:00
|
|
|
// Only events occurring at most |window_duration_| microseconds before the
|
2019-02-13 22:38:25 +01:00
|
|
|
// 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_;
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-13 06:44:41 -07:00
|
|
|
class EventLogAnalyzer {
|
|
|
|
|
public:
|
2018-04-27 14:33:34 +02:00
|
|
|
// The EventLogAnalyzer keeps a reference to the ParsedRtcEventLogNew for the
|
|
|
|
|
// duration of its lifetime. The ParsedRtcEventLogNew must not be destroyed or
|
2016-07-13 06:44:41 -07:00
|
|
|
// modified while the EventLogAnalyzer is being used.
|
2019-01-03 14:46:23 +01:00
|
|
|
EventLogAnalyzer(const ParsedRtcEventLog& log, bool normalize_time);
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
void CreatePacketGraph(PacketDirection direction, Plot* plot);
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2019-02-15 17:20:12 +01:00
|
|
|
void CreateRtcpTypeGraph(PacketDirection direction, Plot* plot);
|
|
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
void CreateAccumulatedPacketsGraph(PacketDirection direction, Plot* plot);
|
2016-09-05 02:46:25 -07:00
|
|
|
|
2016-07-13 06:44:41 -07:00
|
|
|
void CreatePlayoutGraph(Plot* plot);
|
|
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
void CreateAudioLevelGraph(PacketDirection direction, Plot* plot);
|
2016-09-22 07:01:47 -07:00
|
|
|
|
2016-07-13 06:44:41 -07:00
|
|
|
void CreateSequenceNumberGraph(Plot* plot);
|
|
|
|
|
|
2016-09-09 13:37:50 +02:00
|
|
|
void CreateIncomingPacketLossGraph(Plot* plot);
|
|
|
|
|
|
2017-08-15 02:04:02 -07:00
|
|
|
void CreateIncomingDelayGraph(Plot* plot);
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2016-08-04 10:00:11 -07:00
|
|
|
void CreateFractionLossGraph(Plot* plot);
|
|
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
void CreateTotalIncomingBitrateGraph(Plot* plot);
|
|
|
|
|
void CreateTotalOutgoingBitrateGraph(Plot* plot,
|
|
|
|
|
bool show_detector_state = false,
|
|
|
|
|
bool show_alr_state = false);
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
void CreateStreamBitrateGraph(PacketDirection direction, Plot* plot);
|
2019-02-15 17:29:58 +01:00
|
|
|
void CreateBitrateAllocationGraph(PacketDirection direction, Plot* plot);
|
2016-07-13 06:44:41 -07:00
|
|
|
|
2019-03-13 08:56:58 +01:00
|
|
|
void CreateGoogCcSimulationGraph(Plot* plot);
|
2017-10-04 14:22:43 +02:00
|
|
|
void CreateSendSideBweSimulationGraph(Plot* plot);
|
|
|
|
|
void CreateReceiveSideBweSimulationGraph(Plot* plot);
|
2016-07-29 14:48:54 +02:00
|
|
|
|
2016-08-15 08:47:14 -07:00
|
|
|
void CreateNetworkDelayFeedbackGraph(Plot* plot);
|
2017-10-25 17:42:41 +02:00
|
|
|
void CreatePacerDelayGraph(Plot* plot);
|
2018-04-27 14:33:34 +02:00
|
|
|
|
|
|
|
|
void CreateTimestampGraph(PacketDirection direction, Plot* plot);
|
2018-07-24 13:45:31 +02:00
|
|
|
void CreateSenderAndReceiverReportPlot(
|
|
|
|
|
PacketDirection direction,
|
|
|
|
|
rtc::FunctionView<float(const rtcp::ReportBlock&)> fy,
|
|
|
|
|
std::string title,
|
|
|
|
|
std::string yaxis_label,
|
|
|
|
|
Plot* plot);
|
2016-08-02 07:22:17 -07:00
|
|
|
|
2017-02-22 07:33:27 -08:00
|
|
|
void CreateAudioEncoderTargetBitrateGraph(Plot* plot);
|
|
|
|
|
void CreateAudioEncoderFrameLengthGraph(Plot* plot);
|
2017-08-15 02:04:02 -07:00
|
|
|
void CreateAudioEncoderPacketLossGraph(Plot* plot);
|
2017-02-22 07:33:27 -08:00
|
|
|
void CreateAudioEncoderEnableFecGraph(Plot* plot);
|
|
|
|
|
void CreateAudioEncoderEnableDtxGraph(Plot* plot);
|
|
|
|
|
void CreateAudioEncoderNumChannelsGraph(Plot* plot);
|
2018-05-04 09:46:44 +02:00
|
|
|
|
|
|
|
|
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;
|
2018-06-26 13:01:32 +02:00
|
|
|
|
2018-06-21 21:17:19 +02:00
|
|
|
void CreateAudioJitterBufferGraph(uint32_t ssrc,
|
|
|
|
|
const test::NetEqStatsGetter* stats_getter,
|
|
|
|
|
Plot* plot) const;
|
2018-06-26 13:01:32 +02:00
|
|
|
void CreateNetEqNetworkStatsGraph(
|
2018-05-07 15:20:24 +02:00
|
|
|
const NetEqStatsGetterMap& neteq_stats_getters,
|
|
|
|
|
rtc::FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
|
|
|
|
|
const std::string& plot_name,
|
|
|
|
|
Plot* plot) const;
|
2018-06-26 13:01:32 +02:00
|
|
|
void CreateNetEqLifetimeStatsGraph(
|
|
|
|
|
const NetEqStatsGetterMap& neteq_stats_getters,
|
|
|
|
|
rtc::FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
|
|
|
|
|
const std::string& plot_name,
|
|
|
|
|
Plot* plot) const;
|
2017-02-22 07:33:27 -08:00
|
|
|
|
2018-02-02 11:49:44 -08:00
|
|
|
void CreateIceCandidatePairConfigGraph(Plot* plot);
|
|
|
|
|
void CreateIceConnectivityCheckGraph(Plot* plot);
|
|
|
|
|
|
2018-12-07 12:26:28 -08:00
|
|
|
void CreateDtlsTransportStateGraph(Plot* plot);
|
|
|
|
|
void CreateDtlsWritableStateGraph(Plot* plot);
|
|
|
|
|
|
2017-11-30 15:15:25 +01:00
|
|
|
void CreateTriageNotifications();
|
|
|
|
|
void PrintNotifications(FILE* file);
|
|
|
|
|
|
2016-07-13 06:44:41 -07:00
|
|
|
private:
|
2019-02-15 17:29:58 +01:00
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
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();
|
2016-08-08 10:21:04 -07:00
|
|
|
}
|
2018-04-27 14:33:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
2018-04-24 16:28:35 +02:00
|
|
|
}
|
2018-04-27 14:33:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-26 13:01:32 +02:00
|
|
|
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;
|
|
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
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();
|
|
|
|
|
}
|
2018-04-25 14:23:01 +00:00
|
|
|
|
2019-02-15 17:29:58 +01:00
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-27 14:33:34 +02:00
|
|
|
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);
|
|
|
|
|
}
|
2017-11-30 15:15:25 +01:00
|
|
|
|
2018-02-02 11:49:44 -08:00
|
|
|
std::string GetCandidatePairLogDescriptionFromId(uint32_t candidate_pair_id);
|
|
|
|
|
|
2019-01-03 14:46:23 +01:00
|
|
|
const ParsedRtcEventLog& parsed_log_;
|
2016-07-13 06:44:41 -07:00
|
|
|
|
|
|
|
|
// A list of SSRCs we are interested in analysing.
|
|
|
|
|
// If left empty, all SSRCs will be considered relevant.
|
|
|
|
|
std::vector<uint32_t> desired_ssrc_;
|
|
|
|
|
|
2017-06-14 06:09:58 -07:00
|
|
|
// Stores the timestamps for all log segments, in the form of associated start
|
|
|
|
|
// and end events.
|
2018-04-27 14:33:34 +02:00
|
|
|
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_;
|
2018-02-02 11:49:44 -08:00
|
|
|
|
|
|
|
|
std::map<uint32_t, std::string> candidate_pair_desc_by_id_;
|
|
|
|
|
|
2019-02-13 22:38:25 +01:00
|
|
|
AnalyzerConfig config_;
|
2016-07-13 06:44:41 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2019-07-25 13:57:41 +02:00
|
|
|
#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
|