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