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 #include <memory> | 16 #include <memory> |
| 17 #include <set> |
17 #include <utility> | 18 #include <utility> |
18 | 19 |
19 #include "webrtc/call/rtc_event_log_parser.h" | 20 #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/include/rtp_rtcp_defines.h" |
21 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
22 #include "webrtc/tools/event_log_visualizer/plot_base.h" | 23 #include "webrtc/tools/event_log_visualizer/plot_base.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 namespace plotting { | 26 namespace plotting { |
26 | 27 |
(...skipping 18 matching lines...) Expand all Loading... |
45 | 46 |
46 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); | 47 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); |
47 | 48 |
48 void CreateBweGraph(Plot* plot); | 49 void CreateBweGraph(Plot* plot); |
49 | 50 |
50 private: | 51 private: |
51 class StreamId { | 52 class StreamId { |
52 public: | 53 public: |
53 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) | 54 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) |
54 : ssrc_(ssrc), direction_(direction) {} | 55 : ssrc_(ssrc), direction_(direction) {} |
55 bool operator<(const StreamId& other) const; | 56 bool operator<(const StreamId& other) const { |
56 bool operator==(const StreamId& other) const; | 57 return std::tie(ssrc_, direction_) < |
| 58 std::tie(other.ssrc_, other.direction_); |
| 59 } |
| 60 bool operator==(const StreamId& other) const { |
| 61 return std::tie(ssrc_, direction_) == |
| 62 std::tie(other.ssrc_, other.direction_); |
| 63 } |
57 uint32_t GetSsrc() const { return ssrc_; } | 64 uint32_t GetSsrc() const { return ssrc_; } |
58 webrtc::PacketDirection GetDirection() const { return direction_; } | 65 webrtc::PacketDirection GetDirection() const { return direction_; } |
59 | 66 |
60 private: | 67 private: |
61 uint32_t ssrc_; | 68 uint32_t ssrc_; |
62 webrtc::PacketDirection direction_; | 69 webrtc::PacketDirection direction_; |
63 }; | 70 }; |
64 | 71 |
65 struct LoggedRtpPacket { | 72 struct LoggedRtpPacket { |
66 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length) | 73 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length) |
(...skipping 15 matching lines...) Expand all Loading... |
82 std::unique_ptr<rtcp::RtcpPacket> packet; | 89 std::unique_ptr<rtcp::RtcpPacket> packet; |
83 }; | 90 }; |
84 | 91 |
85 struct BwePacketLossEvent { | 92 struct BwePacketLossEvent { |
86 uint64_t timestamp; | 93 uint64_t timestamp; |
87 int32_t new_bitrate; | 94 int32_t new_bitrate; |
88 uint8_t fraction_loss; | 95 uint8_t fraction_loss; |
89 int32_t expected_packets; | 96 int32_t expected_packets; |
90 }; | 97 }; |
91 | 98 |
| 99 bool IsRtxSsrc(StreamId stream_id); |
| 100 |
| 101 bool IsVideoSsrc(StreamId stream_id); |
| 102 |
| 103 bool IsAudioSsrc(StreamId stream_id); |
| 104 |
92 const ParsedRtcEventLog& parsed_log_; | 105 const ParsedRtcEventLog& parsed_log_; |
93 | 106 |
94 // A list of SSRCs we are interested in analysing. | 107 // A list of SSRCs we are interested in analysing. |
95 // If left empty, all SSRCs will be considered relevant. | 108 // If left empty, all SSRCs will be considered relevant. |
96 std::vector<uint32_t> desired_ssrc_; | 109 std::vector<uint32_t> desired_ssrc_; |
97 | 110 |
98 // Maps a stream identifier consisting of ssrc, direction and MediaType | 111 // Tracks what each stream is configured for. Note that a single SSRC can be |
99 // to the parsed RTP headers in that stream. Header extensions are parsed | 112 // in several sets. For example, the SSRC used for sending video over RTX |
100 // if the stream has been configured. | 113 // will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that |
| 114 // an SSRC is reconfigured to a different media type mid-call, it will also |
| 115 // appear in multiple sets. |
| 116 std::set<StreamId> rtx_ssrcs_; |
| 117 std::set<StreamId> video_ssrcs_; |
| 118 std::set<StreamId> audio_ssrcs_; |
| 119 |
| 120 // Maps a stream identifier consisting of ssrc and direction to the parsed |
| 121 // RTP headers in that stream. Header extensions are parsed if the stream |
| 122 // has been configured. |
101 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; | 123 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; |
102 | 124 |
103 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; | 125 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; |
104 | 126 |
105 // A list of all updates from the send-side loss-based bandwidth estimator. | 127 // A list of all updates from the send-side loss-based bandwidth estimator. |
106 std::vector<BwePacketLossEvent> bwe_loss_updates_; | 128 std::vector<BwePacketLossEvent> bwe_loss_updates_; |
107 | 129 |
108 // Window and step size used for calculating moving averages, e.g. bitrate. | 130 // Window and step size used for calculating moving averages, e.g. bitrate. |
109 // The generated data points will be |step_| microseconds apart. | 131 // The generated data points will be |step_| microseconds apart. |
110 // Only events occuring at most |window_duration_| microseconds before the | 132 // Only events occuring at most |window_duration_| microseconds before the |
111 // current data point will be part of the average. | 133 // current data point will be part of the average. |
112 uint64_t window_duration_; | 134 uint64_t window_duration_; |
113 uint64_t step_; | 135 uint64_t step_; |
114 | 136 |
115 // First and last events of the log. | 137 // First and last events of the log. |
116 uint64_t begin_time_; | 138 uint64_t begin_time_; |
117 uint64_t end_time_; | 139 uint64_t end_time_; |
118 | 140 |
119 // Duration (in seconds) of log file. | 141 // Duration (in seconds) of log file. |
120 float call_duration_s_; | 142 float call_duration_s_; |
121 }; | 143 }; |
122 | 144 |
123 } // namespace plotting | 145 } // namespace plotting |
124 } // namespace webrtc | 146 } // namespace webrtc |
125 | 147 |
126 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ | 148 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ |
OLD | NEW |