Chromium Code Reviews| 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 |
| 28 class StreamId { | |
| 29 public: | |
| 30 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) | |
| 31 : ssrc_(ssrc), direction_(direction) {} | |
|
philipel
2016/08/04 12:56:02
Move implementation to .cc file.
terelius
2016/08/05 12:24:57
I prefer to keep trivial constructors in the class
philipel
2016/08/05 12:43:21
I was thinking of moving the full implementation t
terelius
2016/08/05 13:00:17
It makes it easier to verify that all members are
| |
| 32 bool operator<(const StreamId& other) const; | |
| 33 bool operator==(const StreamId& other) const; | |
| 34 uint32_t GetSsrc() const { return ssrc_; } | |
| 35 webrtc::PacketDirection GetDirection() const { return direction_; } | |
| 36 | |
| 37 private: | |
| 38 uint32_t ssrc_; | |
| 39 webrtc::PacketDirection direction_; | |
| 40 }; | |
| 41 | |
| 27 class EventLogAnalyzer { | 42 class EventLogAnalyzer { |
| 28 public: | 43 public: |
| 29 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the | 44 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the |
| 30 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or | 45 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or |
| 31 // modified while the EventLogAnalyzer is being used. | 46 // modified while the EventLogAnalyzer is being used. |
| 32 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); | 47 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); |
| 33 | 48 |
| 49 bool IsRtxSsrc(StreamId stream_id); | |
| 50 | |
| 51 bool IsVideoSsrc(StreamId stream_id); | |
| 52 | |
| 53 bool IsAudioSsrc(StreamId stream_id); | |
| 54 | |
| 34 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); | 55 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); |
| 35 | 56 |
| 36 void CreatePlayoutGraph(Plot* plot); | 57 void CreatePlayoutGraph(Plot* plot); |
| 37 | 58 |
| 38 void CreateSequenceNumberGraph(Plot* plot); | 59 void CreateSequenceNumberGraph(Plot* plot); |
| 39 | 60 |
| 40 void CreateDelayChangeGraph(Plot* plot); | 61 void CreateDelayChangeGraph(Plot* plot); |
| 41 | 62 |
| 42 void CreateAccumulatedDelayChangeGraph(Plot* plot); | 63 void CreateAccumulatedDelayChangeGraph(Plot* plot); |
| 43 | 64 |
| 44 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); | 65 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); |
| 45 | 66 |
| 46 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); | 67 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); |
| 47 | 68 |
| 48 void CreateBweGraph(Plot* plot); | 69 void CreateBweGraph(Plot* plot); |
| 49 | 70 |
| 50 private: | 71 private: |
| 51 class StreamId { | |
| 52 public: | |
| 53 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) | |
| 54 : ssrc_(ssrc), direction_(direction) {} | |
| 55 bool operator<(const StreamId& other) const; | |
| 56 bool operator==(const StreamId& other) const; | |
| 57 uint32_t GetSsrc() const { return ssrc_; } | |
| 58 webrtc::PacketDirection GetDirection() const { return direction_; } | |
| 59 | |
| 60 private: | |
| 61 uint32_t ssrc_; | |
| 62 webrtc::PacketDirection direction_; | |
| 63 }; | |
| 64 | |
| 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) |
| 67 : timestamp(timestamp), header(header), total_length(total_length) {} | 74 : timestamp(timestamp), header(header), total_length(total_length) {} |
| 68 uint64_t timestamp; | 75 uint64_t timestamp; |
| 69 RTPHeader header; | 76 RTPHeader header; |
| 70 size_t total_length; | 77 size_t total_length; |
| 71 }; | 78 }; |
| 72 | 79 |
| 73 struct LoggedRtcpPacket { | 80 struct LoggedRtcpPacket { |
| 74 LoggedRtcpPacket(uint64_t timestamp, | 81 LoggedRtcpPacket(uint64_t timestamp, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 88 uint8_t fraction_loss; | 95 uint8_t fraction_loss; |
| 89 int32_t expected_packets; | 96 int32_t expected_packets; |
| 90 }; | 97 }; |
| 91 | 98 |
| 92 const ParsedRtcEventLog& parsed_log_; | 99 const ParsedRtcEventLog& parsed_log_; |
| 93 | 100 |
| 94 // A list of SSRCs we are interested in analysing. | 101 // A list of SSRCs we are interested in analysing. |
| 95 // If left empty, all SSRCs will be considered relevant. | 102 // If left empty, all SSRCs will be considered relevant. |
| 96 std::vector<uint32_t> desired_ssrc_; | 103 std::vector<uint32_t> desired_ssrc_; |
| 97 | 104 |
| 98 // Maps a stream identifier consisting of ssrc, direction and MediaType | 105 // 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 | 106 // in several sets. For example, the SSRC used for sending video over RTX |
| 100 // if the stream has been configured. | 107 // will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that |
| 108 // an SSRC is reconfigured to a different media type mid-call, it will also | |
| 109 // appear in multiple sets. | |
| 110 std::set<StreamId> rtx_ssrcs_; | |
| 111 std::set<StreamId> video_ssrcs_; | |
| 112 std::set<StreamId> audio_ssrcs_; | |
| 113 | |
| 114 // Maps a stream identifier consisting of ssrc and direction to the parsed | |
| 115 // RTP headers in that stream. Header extensions are parsed if the stream | |
| 116 // has been configured. | |
| 101 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; | 117 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; |
| 102 | 118 |
| 103 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; | 119 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; |
| 104 | 120 |
| 105 // A list of all updates from the send-side loss-based bandwidth estimator. | 121 // A list of all updates from the send-side loss-based bandwidth estimator. |
| 106 std::vector<BwePacketLossEvent> bwe_loss_updates_; | 122 std::vector<BwePacketLossEvent> bwe_loss_updates_; |
| 107 | 123 |
| 108 // Window and step size used for calculating moving averages, e.g. bitrate. | 124 // Window and step size used for calculating moving averages, e.g. bitrate. |
| 109 // The generated data points will be |step_| microseconds apart. | 125 // The generated data points will be |step_| microseconds apart. |
| 110 // Only events occuring at most |window_duration_| microseconds before the | 126 // Only events occuring at most |window_duration_| microseconds before the |
| 111 // current data point will be part of the average. | 127 // current data point will be part of the average. |
| 112 uint64_t window_duration_; | 128 uint64_t window_duration_; |
| 113 uint64_t step_; | 129 uint64_t step_; |
| 114 | 130 |
| 115 // First and last events of the log. | 131 // First and last events of the log. |
| 116 uint64_t begin_time_; | 132 uint64_t begin_time_; |
| 117 uint64_t end_time_; | 133 uint64_t end_time_; |
| 118 | 134 |
| 119 // Duration (in seconds) of log file. | 135 // Duration (in seconds) of log file. |
| 120 float call_duration_s_; | 136 float call_duration_s_; |
| 121 }; | 137 }; |
| 122 | 138 |
| 123 } // namespace plotting | 139 } // namespace plotting |
| 124 } // namespace webrtc | 140 } // namespace webrtc |
| 125 | 141 |
| 126 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ | 142 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ |
| OLD | NEW |