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