Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: webrtc/tools/event_log_visualizer/analyzer.cc

Issue 2207453003: Track SSRCs configured for each media type in event log visualization tool. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Comments from reviewers Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/tools/event_log_visualizer/analyzer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 } 94 }
95 95
96 constexpr float kLeftMargin = 0.01f; 96 constexpr float kLeftMargin = 0.01f;
97 constexpr float kRightMargin = 0.02f; 97 constexpr float kRightMargin = 0.02f;
98 constexpr float kBottomMargin = 0.02f; 98 constexpr float kBottomMargin = 0.02f;
99 constexpr float kTopMargin = 0.05f; 99 constexpr float kTopMargin = 0.05f;
100 100
101 } // namespace 101 } // namespace
102 102
103 bool EventLogAnalyzer::StreamId::operator<(const StreamId& other) const {
104 if (ssrc_ < other.ssrc_) {
105 return true;
106 }
107 if (ssrc_ == other.ssrc_) {
108 if (direction_ < other.direction_) {
109 return true;
110 }
111 }
112 return false;
113 }
114
115 bool EventLogAnalyzer::StreamId::operator==(const StreamId& other) const {
116 return ssrc_ == other.ssrc_ && direction_ == other.direction_;
117 }
118
119
120 EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log) 103 EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log)
121 : parsed_log_(log), window_duration_(250000), step_(10000) { 104 : parsed_log_(log), window_duration_(250000), step_(10000) {
122 uint64_t first_timestamp = std::numeric_limits<uint64_t>::max(); 105 uint64_t first_timestamp = std::numeric_limits<uint64_t>::max();
123 uint64_t last_timestamp = std::numeric_limits<uint64_t>::min(); 106 uint64_t last_timestamp = std::numeric_limits<uint64_t>::min();
124 107
125 // Maps a stream identifier consisting of ssrc and direction 108 // Maps a stream identifier consisting of ssrc and direction
126 // to the header extensions used by that stream, 109 // to the header extensions used by that stream,
127 std::map<StreamId, RtpHeaderExtensionMap> extension_maps; 110 std::map<StreamId, RtpHeaderExtensionMap> extension_maps;
128 111
129 PacketDirection direction; 112 PacketDirection direction;
(...skipping 14 matching lines...) Expand all
144 last_timestamp = std::max(last_timestamp, timestamp); 127 last_timestamp = std::max(last_timestamp, timestamp);
145 } 128 }
146 129
147 switch (parsed_log_.GetEventType(i)) { 130 switch (parsed_log_.GetEventType(i)) {
148 case ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT: { 131 case ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT: {
149 VideoReceiveStream::Config config(nullptr); 132 VideoReceiveStream::Config config(nullptr);
150 parsed_log_.GetVideoReceiveConfig(i, &config); 133 parsed_log_.GetVideoReceiveConfig(i, &config);
151 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket); 134 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket);
152 RegisterHeaderExtensions(config.rtp.extensions, 135 RegisterHeaderExtensions(config.rtp.extensions,
153 &extension_maps[stream]); 136 &extension_maps[stream]);
137 video_ssrcs_.insert(stream);
154 for (auto kv : config.rtp.rtx) { 138 for (auto kv : config.rtp.rtx) {
155 StreamId rtx_stream(kv.second.ssrc, kIncomingPacket); 139 StreamId rtx_stream(kv.second.ssrc, kIncomingPacket);
156 RegisterHeaderExtensions(config.rtp.extensions, 140 RegisterHeaderExtensions(config.rtp.extensions,
157 &extension_maps[rtx_stream]); 141 &extension_maps[rtx_stream]);
142 video_ssrcs_.insert(rtx_stream);
143 rtx_ssrcs_.insert(rtx_stream);
158 } 144 }
159 break; 145 break;
160 } 146 }
161 case ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT: { 147 case ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT: {
162 VideoSendStream::Config config(nullptr); 148 VideoSendStream::Config config(nullptr);
163 parsed_log_.GetVideoSendConfig(i, &config); 149 parsed_log_.GetVideoSendConfig(i, &config);
164 for (auto ssrc : config.rtp.ssrcs) { 150 for (auto ssrc : config.rtp.ssrcs) {
165 StreamId stream(ssrc, kOutgoingPacket); 151 StreamId stream(ssrc, kOutgoingPacket);
166 RegisterHeaderExtensions(config.rtp.extensions, 152 RegisterHeaderExtensions(config.rtp.extensions,
167 &extension_maps[stream]); 153 &extension_maps[stream]);
154 video_ssrcs_.insert(stream);
168 } 155 }
169 for (auto ssrc : config.rtp.rtx.ssrcs) { 156 for (auto ssrc : config.rtp.rtx.ssrcs) {
170 StreamId stream(ssrc, kOutgoingPacket); 157 StreamId rtx_stream(ssrc, kOutgoingPacket);
171 RegisterHeaderExtensions(config.rtp.extensions, 158 RegisterHeaderExtensions(config.rtp.extensions,
172 &extension_maps[stream]); 159 &extension_maps[rtx_stream]);
160 video_ssrcs_.insert(rtx_stream);
161 rtx_ssrcs_.insert(rtx_stream);
173 } 162 }
174 break; 163 break;
175 } 164 }
176 case ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT: { 165 case ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT: {
177 AudioReceiveStream::Config config; 166 AudioReceiveStream::Config config;
178 // TODO(terelius): Parse the audio configs once we have them. 167 // TODO(terelius): Parse the audio configs once we have them.
179 break; 168 break;
180 } 169 }
181 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: { 170 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: {
182 AudioSendStream::Config config(nullptr); 171 AudioSendStream::Config config(nullptr);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 bool bitrate_updated = bitrate_updated_; 285 bool bitrate_updated = bitrate_updated_;
297 bitrate_updated_ = false; 286 bitrate_updated_ = false;
298 return bitrate_updated; 287 return bitrate_updated;
299 } 288 }
300 289
301 private: 290 private:
302 uint32_t last_bitrate_bps_; 291 uint32_t last_bitrate_bps_;
303 bool bitrate_updated_; 292 bool bitrate_updated_;
304 }; 293 };
305 294
295 bool EventLogAnalyzer::IsRtxSsrc(StreamId stream_id) {
296 return rtx_ssrcs_.count(stream_id) == 1;
297 }
298
299 bool EventLogAnalyzer::IsVideoSsrc(StreamId stream_id) {
300 return video_ssrcs_.count(stream_id) == 1;
301 }
302
303 bool EventLogAnalyzer::IsAudioSsrc(StreamId stream_id) {
304 return audio_ssrcs_.count(stream_id) == 1;
305 }
306
306 void EventLogAnalyzer::CreatePacketGraph(PacketDirection desired_direction, 307 void EventLogAnalyzer::CreatePacketGraph(PacketDirection desired_direction,
307 Plot* plot) { 308 Plot* plot) {
308 std::map<uint32_t, TimeSeries> time_series; 309 std::map<uint32_t, TimeSeries> time_series;
309 310
310 PacketDirection direction; 311 PacketDirection direction;
311 MediaType media_type; 312 MediaType media_type;
312 uint8_t header[IP_PACKET_SIZE]; 313 uint8_t header[IP_PACKET_SIZE];
313 size_t header_length, total_length; 314 size_t header_length, total_length;
314 315
315 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { 316 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) {
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 // Add the data set to the plot. 794 // Add the data set to the plot.
794 plot->series_list_.push_back(std::move(time_series)); 795 plot->series_list_.push_back(std::move(time_series));
795 796
796 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 797 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
797 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); 798 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin);
798 plot->SetTitle("Simulated BWE behavior"); 799 plot->SetTitle("Simulated BWE behavior");
799 } 800 }
800 801
801 } // namespace plotting 802 } // namespace plotting
802 } // namespace webrtc 803 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/tools/event_log_visualizer/analyzer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698