blob: ebdfdcc41c1f8548f80451a00a292a8535e7cd3a [file] [log] [blame]
terelius54ce6802016-07-13 06:44:41 -07001/*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei575998c2019-07-25 13:57:41 +020011#ifndef RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
12#define RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_
terelius54ce6802016-07-13 06:44:41 -070013
terelius88e64e52016-07-19 01:51:06 -070014#include <map>
Stefan Holmer13181032016-07-29 14:48:54 +020015#include <memory>
terelius0740a202016-08-08 10:21:04 -070016#include <set>
philipelccd74892016-09-05 02:46:25 -070017#include <string>
Stefan Holmer13181032016-07-29 14:48:54 +020018#include <utility>
philipelccd74892016-09-05 02:46:25 -070019#include <vector>
terelius54ce6802016-07-13 06:44:41 -070020
Sebastian Janssonb290a6d2019-01-03 14:46:23 +010021#include "logging/rtc_event_log/rtc_event_log_parser.h"
Minyue Lic6ff7572018-05-04 09:46:44 +020022#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020023#include "rtc_base/strings/string_builder.h"
Bjorn Terelius48b82792020-05-19 10:57:24 +020024#include "rtc_tools/rtc_event_log_visualizer/analyzer_common.h"
Mirko Bonadei575998c2019-07-25 13:57:41 +020025#include "rtc_tools/rtc_event_log_visualizer/plot_base.h"
terelius54ce6802016-07-13 06:44:41 -070026
27namespace webrtc {
michaelt6e5b2192017-02-22 07:33:27 -080028
terelius54ce6802016-07-13 06:44:41 -070029class EventLogAnalyzer {
30 public:
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020031 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLogNew for the
32 // duration of its lifetime. The ParsedRtcEventLogNew must not be destroyed or
terelius54ce6802016-07-13 06:44:41 -070033 // modified while the EventLogAnalyzer is being used.
Sebastian Janssonb290a6d2019-01-03 14:46:23 +010034 EventLogAnalyzer(const ParsedRtcEventLog& log, bool normalize_time);
Bjorn Terelius48b82792020-05-19 10:57:24 +020035 EventLogAnalyzer(const ParsedRtcEventLog& log, const AnalyzerConfig& config);
terelius54ce6802016-07-13 06:44:41 -070036
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020037 void CreatePacketGraph(PacketDirection direction, Plot* plot);
terelius54ce6802016-07-13 06:44:41 -070038
Bjorn Terelius7c974e62019-02-15 17:20:12 +010039 void CreateRtcpTypeGraph(PacketDirection direction, Plot* plot);
40
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020041 void CreateAccumulatedPacketsGraph(PacketDirection direction, Plot* plot);
philipelccd74892016-09-05 02:46:25 -070042
Kristoffer Erlandsson283c1062020-03-30 13:01:37 +020043 void CreatePacketRateGraph(PacketDirection direction, Plot* plot);
44
Kristoffer Erlandssona2ce4232020-04-01 14:33:30 +020045 void CreateTotalPacketRateGraph(PacketDirection direction, Plot* plot);
46
terelius54ce6802016-07-13 06:44:41 -070047 void CreatePlayoutGraph(Plot* plot);
48
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020049 void CreateAudioLevelGraph(PacketDirection direction, Plot* plot);
ivocaac9d6f2016-09-22 07:01:47 -070050
terelius54ce6802016-07-13 06:44:41 -070051 void CreateSequenceNumberGraph(Plot* plot);
52
Stefan Holmer99f8e082016-09-09 13:37:50 +020053 void CreateIncomingPacketLossGraph(Plot* plot);
54
terelius2ee076d2017-08-15 02:04:02 -070055 void CreateIncomingDelayGraph(Plot* plot);
terelius54ce6802016-07-13 06:44:41 -070056
tereliusf736d232016-08-04 10:00:11 -070057 void CreateFractionLossGraph(Plot* plot);
58
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020059 void CreateTotalIncomingBitrateGraph(Plot* plot);
60 void CreateTotalOutgoingBitrateGraph(Plot* plot,
61 bool show_detector_state = false,
62 bool show_alr_state = false);
terelius54ce6802016-07-13 06:44:41 -070063
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020064 void CreateStreamBitrateGraph(PacketDirection direction, Plot* plot);
Bjorn Terelius9775a582019-02-15 17:29:58 +010065 void CreateBitrateAllocationGraph(PacketDirection direction, Plot* plot);
terelius54ce6802016-07-13 06:44:41 -070066
Sebastian Jansson1175ae02019-03-13 08:56:58 +010067 void CreateGoogCcSimulationGraph(Plot* plot);
Bjorn Terelius28db2662017-10-04 14:22:43 +020068 void CreateSendSideBweSimulationGraph(Plot* plot);
69 void CreateReceiveSideBweSimulationGraph(Plot* plot);
Stefan Holmer13181032016-07-29 14:48:54 +020070
tereliuse34c19c2016-08-15 08:47:14 -070071 void CreateNetworkDelayFeedbackGraph(Plot* plot);
Bjorn Terelius0295a962017-10-25 17:42:41 +020072 void CreatePacerDelayGraph(Plot* plot);
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +020073
74 void CreateTimestampGraph(PacketDirection direction, Plot* plot);
Bjorn Tereliusb1222c22018-07-24 13:45:31 +020075 void CreateSenderAndReceiverReportPlot(
76 PacketDirection direction,
77 rtc::FunctionView<float(const rtcp::ReportBlock&)> fy,
78 std::string title,
79 std::string yaxis_label,
80 Plot* plot);
stefanc3de0332016-08-02 07:22:17 -070081
michaelt6e5b2192017-02-22 07:33:27 -080082 void CreateAudioEncoderTargetBitrateGraph(Plot* plot);
83 void CreateAudioEncoderFrameLengthGraph(Plot* plot);
terelius2ee076d2017-08-15 02:04:02 -070084 void CreateAudioEncoderPacketLossGraph(Plot* plot);
michaelt6e5b2192017-02-22 07:33:27 -080085 void CreateAudioEncoderEnableFecGraph(Plot* plot);
86 void CreateAudioEncoderEnableDtxGraph(Plot* plot);
87 void CreateAudioEncoderNumChannelsGraph(Plot* plot);
Minyue Lic6ff7572018-05-04 09:46:44 +020088
89 using NetEqStatsGetterMap =
90 std::map<uint32_t, std::unique_ptr<test::NetEqStatsGetter>>;
91 NetEqStatsGetterMap SimulateNetEq(const std::string& replacement_file_name,
92 int file_sample_rate_hz) const;
Minyue Lic9ac93f2018-06-26 13:01:32 +020093
Minyue Li01d2a672018-06-21 21:17:19 +020094 void CreateAudioJitterBufferGraph(uint32_t ssrc,
95 const test::NetEqStatsGetter* stats_getter,
96 Plot* plot) const;
Minyue Lic9ac93f2018-06-26 13:01:32 +020097 void CreateNetEqNetworkStatsGraph(
Minyue Li27e2b7d2018-05-07 15:20:24 +020098 const NetEqStatsGetterMap& neteq_stats_getters,
99 rtc::FunctionView<float(const NetEqNetworkStatistics&)> stats_extractor,
100 const std::string& plot_name,
101 Plot* plot) const;
Minyue Lic9ac93f2018-06-26 13:01:32 +0200102 void CreateNetEqLifetimeStatsGraph(
103 const NetEqStatsGetterMap& neteq_stats_getters,
104 rtc::FunctionView<float(const NetEqLifetimeStatistics&)> stats_extractor,
105 const std::string& plot_name,
106 Plot* plot) const;
michaelt6e5b2192017-02-22 07:33:27 -0800107
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800108 void CreateIceCandidatePairConfigGraph(Plot* plot);
109 void CreateIceConnectivityCheckGraph(Plot* plot);
110
Zach Stein10a58012018-12-07 12:26:28 -0800111 void CreateDtlsTransportStateGraph(Plot* plot);
112 void CreateDtlsWritableStateGraph(Plot* plot);
113
Bjorn Terelius2eb31882017-11-30 15:15:25 +0100114 void CreateTriageNotifications();
115 void PrintNotifications(FILE* file);
116
terelius54ce6802016-07-13 06:44:41 -0700117 private:
Minyue Lic9ac93f2018-06-26 13:01:32 +0200118 template <typename NetEqStatsType>
119 void CreateNetEqStatsGraphInternal(
120 const NetEqStatsGetterMap& neteq_stats,
121 rtc::FunctionView<const std::vector<std::pair<int64_t, NetEqStatsType>>*(
122 const test::NetEqStatsGetter*)> data_extractor,
123 rtc::FunctionView<float(const NetEqStatsType&)> stats_extractor,
124 const std::string& plot_name,
125 Plot* plot) const;
126
Bjorn Tereliusc4ca1d32018-04-27 14:33:34 +0200127 template <typename IterableType>
128 void CreateAccumulatedPacketsTimeSeries(Plot* plot,
129 const IterableType& packets,
130 const std::string& label);
philipelccd74892016-09-05 02:46:25 -0700131
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800132 std::string GetCandidatePairLogDescriptionFromId(uint32_t candidate_pair_id);
133
Sebastian Janssonb290a6d2019-01-03 14:46:23 +0100134 const ParsedRtcEventLog& parsed_log_;
terelius54ce6802016-07-13 06:44:41 -0700135
136 // A list of SSRCs we are interested in analysing.
137 // If left empty, all SSRCs will be considered relevant.
138 std::vector<uint32_t> desired_ssrc_;
139
Qingsi Wang8eca1ff2018-02-02 11:49:44 -0800140 std::map<uint32_t, std::string> candidate_pair_desc_by_id_;
141
Bjorn Terelius068fc352019-02-13 22:38:25 +0100142 AnalyzerConfig config_;
terelius54ce6802016-07-13 06:44:41 -0700143};
144
terelius54ce6802016-07-13 06:44:41 -0700145} // namespace webrtc
146
Mirko Bonadei575998c2019-07-25 13:57:41 +0200147#endif // RTC_TOOLS_RTC_EVENT_LOG_VISUALIZER_ANALYZER_H_