Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: webrtc/tools/event_log_visualizer/analyzer.h

Issue 2965593002: Move webrtc/{tools => rtc_tools} (Closed)
Patch Set: Adding back root changes Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/tools/event_log_visualizer/OWNERS ('k') | webrtc/tools/event_log_visualizer/analyzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
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
11 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_
12 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_
13
14 #include <map>
15 #include <memory>
16 #include <set>
17 #include <string>
18 #include <utility>
19 #include <vector>
20
21 #include "webrtc/base/function_view.h"
22 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h"
23 #include "webrtc/modules/audio_coding/audio_network_adaptor/include/audio_networ k_adaptor.h"
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
26 #include "webrtc/tools/event_log_visualizer/plot_base.h"
27
28 namespace webrtc {
29 namespace plotting {
30
31 struct LoggedRtpPacket {
32 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length)
33 : timestamp(timestamp), header(header), total_length(total_length) {}
34 uint64_t timestamp;
35 // TODO(terelius): This allocates space for 15 CSRCs even if none are used.
36 RTPHeader header;
37 size_t total_length;
38 };
39
40 struct LoggedRtcpPacket {
41 LoggedRtcpPacket(uint64_t timestamp,
42 RTCPPacketType rtcp_type,
43 std::unique_ptr<rtcp::RtcpPacket> rtcp_packet)
44 : timestamp(timestamp), type(rtcp_type), packet(std::move(rtcp_packet)) {}
45 uint64_t timestamp;
46 RTCPPacketType type;
47 std::unique_ptr<rtcp::RtcpPacket> packet;
48 };
49
50 struct LossBasedBweUpdate {
51 uint64_t timestamp;
52 int32_t new_bitrate;
53 uint8_t fraction_loss;
54 int32_t expected_packets;
55 };
56
57 struct AudioNetworkAdaptationEvent {
58 uint64_t timestamp;
59 AudioEncoderRuntimeConfig config;
60 };
61
62 class EventLogAnalyzer {
63 public:
64 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the
65 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or
66 // modified while the EventLogAnalyzer is being used.
67 explicit EventLogAnalyzer(const ParsedRtcEventLog& log);
68
69 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot);
70
71 void CreateAccumulatedPacketsGraph(PacketDirection desired_direction,
72 Plot* plot);
73
74 void CreatePlayoutGraph(Plot* plot);
75
76 void CreateAudioLevelGraph(Plot* plot);
77
78 void CreateSequenceNumberGraph(Plot* plot);
79
80 void CreateIncomingPacketLossGraph(Plot* plot);
81
82 void CreateDelayChangeGraph(Plot* plot);
83
84 void CreateAccumulatedDelayChangeGraph(Plot* plot);
85
86 void CreateFractionLossGraph(Plot* plot);
87
88 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot);
89
90 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot);
91
92 void CreateBweSimulationGraph(Plot* plot);
93
94 void CreateNetworkDelayFeedbackGraph(Plot* plot);
95 void CreateTimestampGraph(Plot* plot);
96
97 void CreateAudioEncoderTargetBitrateGraph(Plot* plot);
98 void CreateAudioEncoderFrameLengthGraph(Plot* plot);
99 void CreateAudioEncoderUplinkPacketLossFractionGraph(Plot* plot);
100 void CreateAudioEncoderEnableFecGraph(Plot* plot);
101 void CreateAudioEncoderEnableDtxGraph(Plot* plot);
102 void CreateAudioEncoderNumChannelsGraph(Plot* plot);
103 void CreateAudioJitterBufferGraph(const std::string& replacement_file_name,
104 int file_sample_rate_hz,
105 Plot* plot);
106
107 // Returns a vector of capture and arrival timestamps for the video frames
108 // of the stream with the most number of frames.
109 std::vector<std::pair<int64_t, int64_t>> GetFrameTimestamps() const;
110
111 private:
112 class StreamId {
113 public:
114 StreamId(uint32_t ssrc, webrtc::PacketDirection direction)
115 : ssrc_(ssrc), direction_(direction) {}
116 bool operator<(const StreamId& other) const {
117 return std::tie(ssrc_, direction_) <
118 std::tie(other.ssrc_, other.direction_);
119 }
120 bool operator==(const StreamId& other) const {
121 return std::tie(ssrc_, direction_) ==
122 std::tie(other.ssrc_, other.direction_);
123 }
124 uint32_t GetSsrc() const { return ssrc_; }
125 webrtc::PacketDirection GetDirection() const { return direction_; }
126
127 private:
128 uint32_t ssrc_;
129 webrtc::PacketDirection direction_;
130 };
131
132 template <typename T>
133 void CreateAccumulatedPacketsTimeSeries(
134 PacketDirection desired_direction,
135 Plot* plot,
136 const std::map<StreamId, std::vector<T>>& packets,
137 const std::string& label_prefix);
138
139 bool IsRtxSsrc(StreamId stream_id) const;
140
141 bool IsVideoSsrc(StreamId stream_id) const;
142
143 bool IsAudioSsrc(StreamId stream_id) const;
144
145 std::string GetStreamName(StreamId) const;
146
147 const ParsedRtcEventLog& parsed_log_;
148
149 // A list of SSRCs we are interested in analysing.
150 // If left empty, all SSRCs will be considered relevant.
151 std::vector<uint32_t> desired_ssrc_;
152
153 // Tracks what each stream is configured for. Note that a single SSRC can be
154 // in several sets. For example, the SSRC used for sending video over RTX
155 // will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that
156 // an SSRC is reconfigured to a different media type mid-call, it will also
157 // appear in multiple sets.
158 std::set<StreamId> rtx_ssrcs_;
159 std::set<StreamId> video_ssrcs_;
160 std::set<StreamId> audio_ssrcs_;
161
162 // Maps a stream identifier consisting of ssrc and direction to the parsed
163 // RTP headers in that stream. Header extensions are parsed if the stream
164 // has been configured.
165 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_;
166
167 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_;
168
169 // Maps an SSRC to the timestamps of parsed audio playout events.
170 std::map<uint32_t, std::vector<uint64_t>> audio_playout_events_;
171
172 // Stores the timestamps for all log segments, in the form of associated start
173 // and end events.
174 std::vector<std::pair<uint64_t, uint64_t>> log_segments_;
175
176 // A list of all updates from the send-side loss-based bandwidth estimator.
177 std::vector<LossBasedBweUpdate> bwe_loss_updates_;
178
179 std::vector<AudioNetworkAdaptationEvent> audio_network_adaptation_events_;
180
181 std::vector<ParsedRtcEventLog::BweProbeClusterCreatedEvent>
182 bwe_probe_cluster_created_events_;
183
184 std::vector<ParsedRtcEventLog::BweProbeResultEvent> bwe_probe_result_events_;
185
186 std::vector<ParsedRtcEventLog::BweDelayBasedUpdate> bwe_delay_updates_;
187
188 // Window and step size used for calculating moving averages, e.g. bitrate.
189 // The generated data points will be |step_| microseconds apart.
190 // Only events occuring at most |window_duration_| microseconds before the
191 // current data point will be part of the average.
192 uint64_t window_duration_;
193 uint64_t step_;
194
195 // First and last events of the log.
196 uint64_t begin_time_;
197 uint64_t end_time_;
198
199 // Duration (in seconds) of log file.
200 float call_duration_s_;
201 };
202
203 } // namespace plotting
204 } // namespace webrtc
205
206 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_
OLDNEW
« no previous file with comments | « webrtc/tools/event_log_visualizer/OWNERS ('k') | webrtc/tools/event_log_visualizer/analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698