| 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 <map> | 14 #include <map> |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <set> | 16 #include <set> |
| 17 #include <string> | 17 #include <string> |
| 18 #include <utility> | 18 #include <utility> |
| 19 #include <vector> | 19 #include <vector> |
| 20 | 20 |
| 21 #include "webrtc/base/function_view.h" |
| 21 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" | 22 #include "webrtc/logging/rtc_event_log/rtc_event_log_parser.h" |
| 22 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
| 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet.h" |
| 24 #include "webrtc/tools/event_log_visualizer/plot_base.h" | 25 #include "webrtc/tools/event_log_visualizer/plot_base.h" |
| 25 | 26 |
| 26 namespace webrtc { | 27 namespace webrtc { |
| 27 namespace plotting { | 28 namespace plotting { |
| 28 | 29 |
| 29 struct LoggedRtpPacket { | 30 struct LoggedRtpPacket { |
| 30 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length) | 31 LoggedRtpPacket(uint64_t timestamp, RTPHeader header, size_t total_length) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 std::unique_ptr<rtcp::RtcpPacket> packet; | 46 std::unique_ptr<rtcp::RtcpPacket> packet; |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 struct LossBasedBweUpdate { | 49 struct LossBasedBweUpdate { |
| 49 uint64_t timestamp; | 50 uint64_t timestamp; |
| 50 int32_t new_bitrate; | 51 int32_t new_bitrate; |
| 51 uint8_t fraction_loss; | 52 uint8_t fraction_loss; |
| 52 int32_t expected_packets; | 53 int32_t expected_packets; |
| 53 }; | 54 }; |
| 54 | 55 |
| 56 struct AudioNetworkAdaptationEvent { |
| 57 uint64_t timestamp; |
| 58 AudioNetworkAdaptor::EncoderRuntimeConfig config; |
| 59 }; |
| 60 |
| 55 class EventLogAnalyzer { | 61 class EventLogAnalyzer { |
| 56 public: | 62 public: |
| 57 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the | 63 // The EventLogAnalyzer keeps a reference to the ParsedRtcEventLog for the |
| 58 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or | 64 // duration of its lifetime. The ParsedRtcEventLog must not be destroyed or |
| 59 // modified while the EventLogAnalyzer is being used. | 65 // modified while the EventLogAnalyzer is being used. |
| 60 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); | 66 explicit EventLogAnalyzer(const ParsedRtcEventLog& log); |
| 61 | 67 |
| 62 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); | 68 void CreatePacketGraph(PacketDirection desired_direction, Plot* plot); |
| 63 | 69 |
| 64 void CreateAccumulatedPacketsGraph(PacketDirection desired_direction, | 70 void CreateAccumulatedPacketsGraph(PacketDirection desired_direction, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 80 | 86 |
| 81 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); | 87 void CreateTotalBitrateGraph(PacketDirection desired_direction, Plot* plot); |
| 82 | 88 |
| 83 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); | 89 void CreateStreamBitrateGraph(PacketDirection desired_direction, Plot* plot); |
| 84 | 90 |
| 85 void CreateBweSimulationGraph(Plot* plot); | 91 void CreateBweSimulationGraph(Plot* plot); |
| 86 | 92 |
| 87 void CreateNetworkDelayFeedbackGraph(Plot* plot); | 93 void CreateNetworkDelayFeedbackGraph(Plot* plot); |
| 88 void CreateTimestampGraph(Plot* plot); | 94 void CreateTimestampGraph(Plot* plot); |
| 89 | 95 |
| 96 void CreateAudioEncoderTargetBitrateGraph(Plot* plot); |
| 97 void CreateAudioEncoderFrameLengthGraph(Plot* plot); |
| 98 void CreateAudioEncoderUplinkPacketLossFractionGraph(Plot* plot); |
| 99 void CreateAudioEncoderEnableFecGraph(Plot* plot); |
| 100 void CreateAudioEncoderEnableDtxGraph(Plot* plot); |
| 101 void CreateAudioEncoderNumChannelsGraph(Plot* plot); |
| 102 |
| 90 // Returns a vector of capture and arrival timestamps for the video frames | 103 // Returns a vector of capture and arrival timestamps for the video frames |
| 91 // of the stream with the most number of frames. | 104 // of the stream with the most number of frames. |
| 92 std::vector<std::pair<int64_t, int64_t>> GetFrameTimestamps() const; | 105 std::vector<std::pair<int64_t, int64_t>> GetFrameTimestamps() const; |
| 93 | 106 |
| 94 private: | 107 private: |
| 95 class StreamId { | 108 class StreamId { |
| 96 public: | 109 public: |
| 97 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) | 110 StreamId(uint32_t ssrc, webrtc::PacketDirection direction) |
| 98 : ssrc_(ssrc), direction_(direction) {} | 111 : ssrc_(ssrc), direction_(direction) {} |
| 99 bool operator<(const StreamId& other) const { | 112 bool operator<(const StreamId& other) const { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 120 const std::string& label_prefix); | 133 const std::string& label_prefix); |
| 121 | 134 |
| 122 bool IsRtxSsrc(StreamId stream_id) const; | 135 bool IsRtxSsrc(StreamId stream_id) const; |
| 123 | 136 |
| 124 bool IsVideoSsrc(StreamId stream_id) const; | 137 bool IsVideoSsrc(StreamId stream_id) const; |
| 125 | 138 |
| 126 bool IsAudioSsrc(StreamId stream_id) const; | 139 bool IsAudioSsrc(StreamId stream_id) const; |
| 127 | 140 |
| 128 std::string GetStreamName(StreamId) const; | 141 std::string GetStreamName(StreamId) const; |
| 129 | 142 |
| 143 void FillAudioEncoderTimeSeries( |
| 144 Plot* plot, |
| 145 rtc::FunctionView<rtc::Optional<float>( |
| 146 const AudioNetworkAdaptationEvent& ana_event)> get_y) const; |
| 147 |
| 130 const ParsedRtcEventLog& parsed_log_; | 148 const ParsedRtcEventLog& parsed_log_; |
| 131 | 149 |
| 132 // A list of SSRCs we are interested in analysing. | 150 // A list of SSRCs we are interested in analysing. |
| 133 // If left empty, all SSRCs will be considered relevant. | 151 // If left empty, all SSRCs will be considered relevant. |
| 134 std::vector<uint32_t> desired_ssrc_; | 152 std::vector<uint32_t> desired_ssrc_; |
| 135 | 153 |
| 136 // Tracks what each stream is configured for. Note that a single SSRC can be | 154 // Tracks what each stream is configured for. Note that a single SSRC can be |
| 137 // in several sets. For example, the SSRC used for sending video over RTX | 155 // in several sets. For example, the SSRC used for sending video over RTX |
| 138 // will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that | 156 // will appear in both video_ssrcs_ and rtx_ssrcs_. In the unlikely case that |
| 139 // an SSRC is reconfigured to a different media type mid-call, it will also | 157 // an SSRC is reconfigured to a different media type mid-call, it will also |
| 140 // appear in multiple sets. | 158 // appear in multiple sets. |
| 141 std::set<StreamId> rtx_ssrcs_; | 159 std::set<StreamId> rtx_ssrcs_; |
| 142 std::set<StreamId> video_ssrcs_; | 160 std::set<StreamId> video_ssrcs_; |
| 143 std::set<StreamId> audio_ssrcs_; | 161 std::set<StreamId> audio_ssrcs_; |
| 144 | 162 |
| 145 // Maps a stream identifier consisting of ssrc and direction to the parsed | 163 // Maps a stream identifier consisting of ssrc and direction to the parsed |
| 146 // RTP headers in that stream. Header extensions are parsed if the stream | 164 // RTP headers in that stream. Header extensions are parsed if the stream |
| 147 // has been configured. | 165 // has been configured. |
| 148 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; | 166 std::map<StreamId, std::vector<LoggedRtpPacket>> rtp_packets_; |
| 149 | 167 |
| 150 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; | 168 std::map<StreamId, std::vector<LoggedRtcpPacket>> rtcp_packets_; |
| 151 | 169 |
| 152 // A list of all updates from the send-side loss-based bandwidth estimator. | 170 // A list of all updates from the send-side loss-based bandwidth estimator. |
| 153 std::vector<LossBasedBweUpdate> bwe_loss_updates_; | 171 std::vector<LossBasedBweUpdate> bwe_loss_updates_; |
| 154 | 172 |
| 173 std::vector<AudioNetworkAdaptationEvent> audio_network_adaptation_events_; |
| 174 |
| 155 // Window and step size used for calculating moving averages, e.g. bitrate. | 175 // Window and step size used for calculating moving averages, e.g. bitrate. |
| 156 // The generated data points will be |step_| microseconds apart. | 176 // The generated data points will be |step_| microseconds apart. |
| 157 // Only events occuring at most |window_duration_| microseconds before the | 177 // Only events occuring at most |window_duration_| microseconds before the |
| 158 // current data point will be part of the average. | 178 // current data point will be part of the average. |
| 159 uint64_t window_duration_; | 179 uint64_t window_duration_; |
| 160 uint64_t step_; | 180 uint64_t step_; |
| 161 | 181 |
| 162 // First and last events of the log. | 182 // First and last events of the log. |
| 163 uint64_t begin_time_; | 183 uint64_t begin_time_; |
| 164 uint64_t end_time_; | 184 uint64_t end_time_; |
| 165 | 185 |
| 166 // Duration (in seconds) of log file. | 186 // Duration (in seconds) of log file. |
| 167 float call_duration_s_; | 187 float call_duration_s_; |
| 168 }; | 188 }; |
| 169 | 189 |
| 170 } // namespace plotting | 190 } // namespace plotting |
| 171 } // namespace webrtc | 191 } // namespace webrtc |
| 172 | 192 |
| 173 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ | 193 #endif // WEBRTC_TOOLS_EVENT_LOG_VISUALIZER_ANALYZER_H_ |
| OLD | NEW |