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

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

Issue 2193763002: Reland: Add BWE plot to event log analyzer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix lib fuzzer. Created 4 years, 4 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/DEPS ('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
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ 11 #ifndef WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_
12 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ 12 #define WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_
13 13
14 #include <vector> 14 #include <vector>
15 #include <map> 15 #include <map>
16 #include <memory>
17 #include <utility>
16 18
17 #include "webrtc/call/rtc_event_log_parser.h" 19 #include "webrtc/call/rtc_event_log_parser.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h"
18 #include "webrtc/tools/event_log_visualizer/plot_base.h" 22 #include "webrtc/tools/event_log_visualizer/plot_base.h"
19 23
20 namespace webrtc { 24 namespace webrtc {
21 namespace plotting { 25 namespace plotting {
22 26
23 class EventLogAnalyzer { 27 class EventLogAnalyzer {
24 public: 28 public:
25 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the 29 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the
26 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or 30 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or
27 // modified while the EventLogAnalyzer is being used. 31 // modified while the EventLogAnalyzer is being used.
28 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); 32 explicit EventLogAnalyzer(const ParsedRtcEventLog& log);
29 33
30 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); 34 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot);
31 35
32 void CreatePlayoutGraph(Plot* plot); 36 void CreatePlayoutGraph(Plot* plot);
33 37
34 void CreateSequenceNumberGraph(Plot* plot); 38 void CreateSequenceNumberGraph(Plot* plot);
35 39
36 void CreateDelayChangeGraph(Plot* plot); 40 void CreateDelayChangeGraph(Plot* plot);
37 41
38 void CreateAccumulatedDelayChangeGraph(Plot* plot); 42 void CreateAccumulatedDelayChangeGraph(Plot* plot);
39 43
40 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); 44 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot);
41 45
42 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); 46 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot);
43 47
48 void CreateBweGraph(Plot* plot);
49
44 private: 50 private:
45 class StreamId { 51 class StreamId {
46 public: 52 public:
47 StreamId(uint32_t ssrc, 53 StreamId(uint32_t ssrc, webrtc::PacketDirection direction)
48 webrtc::PacketDirection direction, 54 : ssrc_(ssrc), direction_(direction) {}
49 webrtc::MediaType media_type)
50 : ssrc_(ssrc), direction_(direction), media_type_(media_type) {}
51 bool operator<(const StreamId& other) const; 55 bool operator<(const StreamId& other) const;
52 bool operator==(const StreamId& other) const; 56 bool operator==(const StreamId& other) const;
53 uint32_t GetSsrc() const { return ssrc_; } 57 uint32_t GetSsrc() const { return ssrc_; }
54 webrtc::PacketDirection GetDirection() const { return direction_; } 58 webrtc::PacketDirection GetDirection() const { return direction_; }
55 webrtc::MediaType GetMediaType() const { return media_type_; }
56 59
57 private: 60 private:
58 uint32_t ssrc_; 61 uint32_t ssrc_;
59 webrtc::PacketDirection direction_; 62 webrtc::PacketDirection direction_;
60 webrtc::MediaType media_type_;
61 }; 63 };
62 64
63 struct LoggedRtpPacket { 65 struct LoggedRtpPacket {
64 LoggedRtpPacket(uint64_t timestamp, RTPHeader header) 66 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length)
65 : timestamp(timestamp), header(header) {} 67 : timestamp(timestamp), header(header), total_length(total_length) {}
66 uint64_t timestamp; 68 uint64_t timestamp;
67 RTPHeader header; 69 RTPHeader header;
70 size_t total_length;
71 };
72
73 struct LoggedRtcpPacket {
74 LoggedRtcpPacket(uint64_t timestamp,
75 RTCPPacketType rtcp_type,
76 std::unique_ptr<rtcp::RtcpPacket> rtcp_packet)
77 : timestamp(timestamp),
78 type(rtcp_type),
79 packet(std::move(rtcp_packet)) {}
80 uint64_t timestamp;
81 RTCPPacketType type;
82 std::unique_ptr<rtcp::RtcpPacket> packet;
68 }; 83 };
69 84
70 struct BwePacketLossEvent { 85 struct BwePacketLossEvent {
71 uint64_t timestamp; 86 uint64_t timestamp;
72 int32_t new_bitrate; 87 int32_t new_bitrate;
73 uint8_t fraction_loss; 88 uint8_t fraction_loss;
74 int32_t expected_packets; 89 int32_t expected_packets;
75 }; 90 };
76 91
77 const ParsedRtcEventLog& parsed_log_; 92 const ParsedRtcEventLog& parsed_log_;
78 93
79 // A list of SSRCs we are interested in analysing. 94 // A list of SSRCs we are interested in analysing.
80 // If left empty, all SSRCs will be considered relevant. 95 // If left empty, all SSRCs will be considered relevant.
81 std::vector<uint32_t> desired_ssrc_; 96 std::vector<uint32_t> desired_ssrc_;
82 97
83 // Maps a stream identifier consisting of ssrc, direction and MediaType 98 // Maps a stream identifier consisting of ssrc, direction and MediaType
84 // to the parsed RTP headers in that stream. Header extensions are parsed 99 // to the parsed RTP headers in that stream. Header extensions are parsed
85 // if the stream has been configured. 100 // if the stream has been configured.
86 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; 101 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_;
87 102
103 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_;
104
88 // A list of all updates from the send-side loss-based bandwidth estimator. 105 // A list of all updates from the send-side loss-based bandwidth estimator.
89 std::vector<BwePacketLossEvent> bwe_loss_updates_; 106 std::vector<BwePacketLossEvent> bwe_loss_updates_;
90 107
91 // Window and step size used for calculating moving averages, e.g. bitrate. 108 // Window and step size used for calculating moving averages, e.g. bitrate.
92 // The generated data points will be |step_| microseconds apart. 109 // The generated data points will be |step_| microseconds apart.
93 // Only events occuring at most |window_duration_| microseconds before the 110 // Only events occuring at most |window_duration_| microseconds before the
94 // current data point will be part of the average. 111 // current data point will be part of the average.
95 uint64_t window_duration_; 112 uint64_t window_duration_;
96 uint64_t step_; 113 uint64_t step_;
97 114
98 // First and last events of the log. 115 // First and last events of the log.
99 uint64_t begin_time_; 116 uint64_t begin_time_;
100 uint64_t end_time_; 117 uint64_t end_time_;
101 }; 118 };
102 119
103 } // namespace plotting 120 } // namespace plotting
104 } // namespace webrtc 121 } // namespace webrtc
105 122
106 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ 123 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_
OLDNEW
« no previous file with comments | « webrtc/tools/DEPS ('k') | webrtc/tools/event_log_visualizer/analyzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698