OLD | NEW |
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 | 16 |
17 #include "webrtc/call/rtc_event_log_parser.h" | 17 #include "webrtc/call/rtc_event_log_parser.h" |
| 18 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
18 #include "webrtc/tools/event_log_visualizer/plot_base.h" | 20 #include "webrtc/tools/event_log_visualizer/plot_base.h" |
19 | 21 |
20 namespace webrtc { | 22 namespace webrtc { |
21 namespace plotting { | 23 namespace plotting { |
22 | 24 |
23 class EventLogAnalyzer { | 25 class EventLogAnalyzer { |
24 public: | 26 public: |
25 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the | 27 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the |
26 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or | 28 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or |
27 // modified while the EventLogAnalyzer is being used. | 29 // modified while the EventLogAnalyzer is being used. |
28 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); | 30 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); |
29 | 31 |
30 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); | 32 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); |
31 | 33 |
32 void CreatePlayoutGraph(Plot* plot); | 34 void CreatePlayoutGraph(Plot* plot); |
33 | 35 |
34 void CreateSequenceNumberGraph(Plot* plot); | 36 void CreateSequenceNumberGraph(Plot* plot); |
35 | 37 |
36 void CreateDelayChangeGraph(Plot* plot); | 38 void CreateDelayChangeGraph(Plot* plot); |
37 | 39 |
38 void CreateAccumulatedDelayChangeGraph(Plot* plot); | 40 void CreateAccumulatedDelayChangeGraph(Plot* plot); |
39 | 41 |
40 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); | 42 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); |
41 | 43 |
42 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); | 44 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); |
43 | 45 |
| 46 void CreateBweGraph(Plot* plot); |
| 47 |
44 private: | 48 private: |
45 class StreamId { | 49 class StreamId { |
46 public: | 50 public: |
47 StreamId(uint32_t ssrc, | 51 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) |
48 webrtc::PacketDirection direction, | 52 : 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; | 53 bool operator<(const StreamId& other) const; |
52 bool operator==(const StreamId& other) const; | 54 bool operator==(const StreamId& other) const; |
53 uint32_t GetSsrc() const { return ssrc_; } | 55 uint32_t GetSsrc() const { return ssrc_; } |
54 webrtc::PacketDirection GetDirection() const { return direction_; } | 56 webrtc::PacketDirection GetDirection() const { return direction_; } |
55 webrtc::MediaType GetMediaType() const { return media_type_; } | |
56 | 57 |
57 private: | 58 private: |
58 uint32_t ssrc_; | 59 uint32_t ssrc_; |
59 webrtc::PacketDirection direction_; | 60 webrtc::PacketDirection direction_; |
60 webrtc::MediaType media_type_; | |
61 }; | 61 }; |
62 | 62 |
63 struct LoggedRtpPacket { | 63 struct LoggedRtpPacket { |
64 LoggedRtpPacket(uint64_t timestamp, RTPHeader header) | 64 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length) |
65 : timestamp(timestamp), header(header) {} | 65 : timestamp(timestamp), header(header), total_length(total_length) {} |
66 uint64_t timestamp; | 66 uint64_t timestamp; |
67 RTPHeader header; | 67 RTPHeader header; |
| 68 size_t total_length; |
| 69 }; |
| 70 |
| 71 struct LoggedRtcpPacket { |
| 72 LoggedRtcpPacket(uint64_t timestamp, |
| 73 RTCPPacketType rtcp_type, |
| 74 std::unique_ptr<rtcp::RtcpPacket> rtcp_packet) |
| 75 : timestamp(timestamp), |
| 76 type(rtcp_type), |
| 77 packet(std::move(rtcp_packet)) {} |
| 78 uint64_t timestamp; |
| 79 RTCPPacketType type; |
| 80 std::unique_ptr<rtcp::RtcpPacket> packet; |
68 }; | 81 }; |
69 | 82 |
70 struct BwePacketLossEvent { | 83 struct BwePacketLossEvent { |
71 uint64_t timestamp; | 84 uint64_t timestamp; |
72 int32_t new_bitrate; | 85 int32_t new_bitrate; |
73 uint8_t fraction_loss; | 86 uint8_t fraction_loss; |
74 int32_t expected_packets; | 87 int32_t expected_packets; |
75 }; | 88 }; |
76 | 89 |
77 const ParsedRtcEventLog& parsed_log_; | 90 const ParsedRtcEventLog& parsed_log_; |
78 | 91 |
79 // A list of SSRCs we are interested in analysing. | 92 // A list of SSRCs we are interested in analysing. |
80 // If left empty, all SSRCs will be considered relevant. | 93 // If left empty, all SSRCs will be considered relevant. |
81 std::vector<uint32_t> desired_ssrc_; | 94 std::vector<uint32_t> desired_ssrc_; |
82 | 95 |
83 // Maps a stream identifier consisting of ssrc, direction and MediaType | 96 // Maps a stream identifier consisting of ssrc, direction and MediaType |
84 // to the parsed RTP headers in that stream. Header extensions are parsed | 97 // to the parsed RTP headers in that stream. Header extensions are parsed |
85 // if the stream has been configured. | 98 // if the stream has been configured. |
86 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; | 99 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; |
87 | 100 |
| 101 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; |
| 102 |
88 // A list of all updates from the send-side loss-based bandwidth estimator. | 103 // A list of all updates from the send-side loss-based bandwidth estimator. |
89 std::vector<BwePacketLossEvent> bwe_loss_updates_; | 104 std::vector<BwePacketLossEvent> bwe_loss_updates_; |
90 | 105 |
91 // Window and step size used for calculating moving averages, e.g. bitrate. | 106 // Window and step size used for calculating moving averages, e.g. bitrate. |
92 // The generated data points will be |step_| microseconds apart. | 107 // The generated data points will be |step_| microseconds apart. |
93 // Only events occuring at most |window_duration_| microseconds before the | 108 // Only events occuring at most |window_duration_| microseconds before the |
94 // current data point will be part of the average. | 109 // current data point will be part of the average. |
95 uint64_t window_duration_; | 110 uint64_t window_duration_; |
96 uint64_t step_; | 111 uint64_t step_; |
97 | 112 |
98 // First and last events of the log. | 113 // First and last events of the log. |
99 uint64_t begin_time_; | 114 uint64_t begin_time_; |
100 uint64_t end_time_; | 115 uint64_t end_time_; |
101 }; | 116 }; |
102 | 117 |
103 } // namespace plotting | 118 } // namespace plotting |
104 } // namespace webrtc | 119 } // namespace webrtc |
105 | 120 |
106 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ | 121 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ |
OLD | NEW |