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 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 { | 103 bool StreamId::operator<(const StreamId& other) const { |
| 104 if (ssrc_ < other.ssrc_) { | 104 if (ssrc_ < other.ssrc_) { |
| 105 return true; | 105 return true; |
| 106 } | 106 } |
| 107 if (ssrc_ == other.ssrc_) { | 107 if (ssrc_ == other.ssrc_) { |
| 108 if (direction_ < other.direction_) { | 108 if (direction_ < other.direction_) { |
| 109 return true; | 109 return true; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool EventLogAnalyzer::StreamId::operator==(const StreamId& other) const { | 115 bool StreamId::operator==(const StreamId& other) const { |
| 116 return ssrc_ == other.ssrc_ && direction_ == other.direction_; | 116 return ssrc_ == other.ssrc_ && direction_ == other.direction_; |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log) | 120 EventLogAnalyzer::EventLogAnalyzer(const ParsedRtcEventLog& log) |
| 121 : parsed_log_(log), window_duration_(250000), step_(10000) { | 121 : parsed_log_(log), window_duration_(250000), step_(10000) { |
| 122 uint64_t first_timestamp = std::numeric_limits<uint64_t>::max(); | 122 uint64_t first_timestamp = std::numeric_limits<uint64_t>::max(); |
| 123 uint64_t last_timestamp = std::numeric_limits<uint64_t>::min(); | 123 uint64_t last_timestamp = std::numeric_limits<uint64_t>::min(); |
| 124 | 124 |
| 125 // Maps a stream identifier consisting of ssrc and direction | 125 // Maps a stream identifier consisting of ssrc and direction |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 144 last_timestamp = std::max(last_timestamp, timestamp); | 144 last_timestamp = std::max(last_timestamp, timestamp); |
| 145 } | 145 } |
| 146 | 146 |
| 147 switch (parsed_log_.GetEventType(i)) { | 147 switch (parsed_log_.GetEventType(i)) { |
| 148 case ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT: { | 148 case ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT: { |
| 149 VideoReceiveStream::Config config(nullptr); | 149 VideoReceiveStream::Config config(nullptr); |
| 150 parsed_log_.GetVideoReceiveConfig(i, &config); | 150 parsed_log_.GetVideoReceiveConfig(i, &config); |
| 151 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket); | 151 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket); |
| 152 RegisterHeaderExtensions(config.rtp.extensions, | 152 RegisterHeaderExtensions(config.rtp.extensions, |
| 153 &extension_maps[stream]); | 153 &extension_maps[stream]); |
| 154 video_ssrcs_.insert(stream); | |
| 154 for (auto kv : config.rtp.rtx) { | 155 for (auto kv : config.rtp.rtx) { |
| 155 StreamId rtx_stream(kv.second.ssrc, kIncomingPacket); | 156 StreamId rtx_stream(kv.second.ssrc, kIncomingPacket); |
| 156 RegisterHeaderExtensions(config.rtp.extensions, | 157 RegisterHeaderExtensions(config.rtp.extensions, |
| 157 &extension_maps[rtx_stream]); | 158 &extension_maps[rtx_stream]); |
| 159 video_ssrcs_.insert(rtx_stream); | |
| 160 rtx_ssrcs_.insert(rtx_stream); | |
| 158 } | 161 } |
| 159 break; | 162 break; |
| 160 } | 163 } |
| 161 case ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT: { | 164 case ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT: { |
| 162 VideoSendStream::Config config(nullptr); | 165 VideoSendStream::Config config(nullptr); |
| 163 parsed_log_.GetVideoSendConfig(i, &config); | 166 parsed_log_.GetVideoSendConfig(i, &config); |
| 164 for (auto ssrc : config.rtp.ssrcs) { | 167 for (auto ssrc : config.rtp.ssrcs) { |
| 165 StreamId stream(ssrc, kOutgoingPacket); | 168 StreamId stream(ssrc, kOutgoingPacket); |
| 166 RegisterHeaderExtensions(config.rtp.extensions, | 169 RegisterHeaderExtensions(config.rtp.extensions, |
| 167 &extension_maps[stream]); | 170 &extension_maps[stream]); |
| 171 video_ssrcs_.insert(stream); | |
| 168 } | 172 } |
| 169 for (auto ssrc : config.rtp.rtx.ssrcs) { | 173 for (auto ssrc : config.rtp.rtx.ssrcs) { |
| 170 StreamId stream(ssrc, kOutgoingPacket); | 174 StreamId rtx_stream(ssrc, kOutgoingPacket); |
| 171 RegisterHeaderExtensions(config.rtp.extensions, | 175 RegisterHeaderExtensions(config.rtp.extensions, |
| 172 &extension_maps[stream]); | 176 &extension_maps[rtx_stream]); |
| 177 video_ssrcs_.insert(rtx_stream); | |
| 178 rtx_ssrcs_.insert(rtx_stream); | |
| 173 } | 179 } |
| 174 break; | 180 break; |
| 175 } | 181 } |
| 176 case ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT: { | 182 case ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT: { |
| 177 AudioReceiveStream::Config config; | 183 AudioReceiveStream::Config config; |
| 178 // TODO(terelius): Parse the audio configs once we have them. | 184 // TODO(terelius): Parse the audio configs once we have them. |
| 179 break; | 185 break; |
| 180 } | 186 } |
| 181 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: { | 187 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: { |
| 182 AudioSendStream::Config config(nullptr); | 188 AudioSendStream::Config config(nullptr); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 bool bitrate_updated = bitrate_updated_; | 302 bool bitrate_updated = bitrate_updated_; |
| 297 bitrate_updated_ = false; | 303 bitrate_updated_ = false; |
| 298 return bitrate_updated; | 304 return bitrate_updated; |
| 299 } | 305 } |
| 300 | 306 |
| 301 private: | 307 private: |
| 302 uint32_t last_bitrate_bps_; | 308 uint32_t last_bitrate_bps_; |
| 303 bool bitrate_updated_; | 309 bool bitrate_updated_; |
| 304 }; | 310 }; |
| 305 | 311 |
| 312 bool EventLogAnalyzer::IsRtxSsrc(StreamId stream_id) { | |
| 313 return (rtx_ssrcs_.count(stream_id) == 1); | |
|
stefan-webrtc
2016/08/04 14:22:55
I think you can remove ().
I'd also prefer using
terelius
2016/08/05 12:24:57
Removed the parenthesis. I prefer count() since th
| |
| 314 } | |
| 315 | |
| 316 bool EventLogAnalyzer::IsVideoSsrc(StreamId stream_id) { | |
| 317 return (video_ssrcs_.count(stream_id) == 1); | |
| 318 } | |
| 319 | |
| 320 bool EventLogAnalyzer::IsAudioSsrc(StreamId stream_id) { | |
| 321 return (audio_ssrcs_.count(stream_id) == 1); | |
| 322 } | |
| 323 | |
| 306 void EventLogAnalyzer::CreatePacketGraph(PacketDirection desired_direction, | 324 void EventLogAnalyzer::CreatePacketGraph(PacketDirection desired_direction, |
| 307 Plot* plot) { | 325 Plot* plot) { |
| 308 std::map<uint32_t, TimeSeries> time_series; | 326 std::map<uint32_t, TimeSeries> time_series; |
| 309 | 327 |
| 310 PacketDirection direction; | 328 PacketDirection direction; |
| 311 MediaType media_type; | 329 MediaType media_type; |
| 312 uint8_t header[IP_PACKET_SIZE]; | 330 uint8_t header[IP_PACKET_SIZE]; |
| 313 size_t header_length, total_length; | 331 size_t header_length, total_length; |
| 314 | 332 |
| 315 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { | 333 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 793 // Add the data set to the plot. | 811 // Add the data set to the plot. |
| 794 plot->series_list_.push_back(std::move(time_series)); | 812 plot->series_list_.push_back(std::move(time_series)); |
| 795 | 813 |
| 796 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 814 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 797 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); | 815 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); |
| 798 plot->SetTitle("Simulated BWE behavior"); | 816 plot->SetTitle("Simulated BWE behavior"); |
| 799 } | 817 } |
| 800 | 818 |
| 801 } // namespace plotting | 819 } // namespace plotting |
| 802 } // namespace webrtc | 820 } // namespace webrtc |
| OLD | NEW |