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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1100 | 1100 |
| 1101 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1101 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1102 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin); | 1102 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin); |
| 1103 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { | 1103 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { |
| 1104 plot->SetTitle("Incoming bitrate per stream"); | 1104 plot->SetTitle("Incoming bitrate per stream"); |
| 1105 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) { | 1105 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) { |
| 1106 plot->SetTitle("Outgoing bitrate per stream"); | 1106 plot->SetTitle("Outgoing bitrate per stream"); |
| 1107 } | 1107 } |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 void EventLogAnalyzer::CreateBweSimulationGraph(Plot* plot) { | 1110 void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) { |
| 1111 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp; | 1111 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp; |
| 1112 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp; | 1112 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp; |
| 1113 | 1113 |
| 1114 for (const auto& kv : rtp_packets_) { | 1114 for (const auto& kv : rtp_packets_) { |
| 1115 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) { | 1115 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) { |
| 1116 for (const LoggedRtpPacket& rtp_packet : kv.second) | 1116 for (const LoggedRtpPacket& rtp_packet : kv.second) |
| 1117 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); | 1117 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); |
| 1118 } | 1118 } |
| 1119 } | 1119 } |
| 1120 | 1120 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 last_update_us = time_us; | 1219 last_update_us = time_us; |
| 1220 } | 1220 } |
| 1221 time_us = std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()}); | 1221 time_us = std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()}); |
| 1222 } | 1222 } |
| 1223 // Add the data set to the plot. | 1223 // Add the data set to the plot. |
| 1224 plot->AppendTimeSeries(std::move(time_series)); | 1224 plot->AppendTimeSeries(std::move(time_series)); |
| 1225 plot->AppendTimeSeries(std::move(acked_time_series)); | 1225 plot->AppendTimeSeries(std::move(acked_time_series)); |
| 1226 | 1226 |
| 1227 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1227 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1228 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); | 1228 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); |
| 1229 plot->SetTitle("Simulated BWE behavior"); | 1229 plot->SetTitle("Simulated send-side BWE behavior"); |
| 1230 } | |
| 1231 | |
| 1232 void EventLogAnalyzer::CreateReceiveSideBweSimulationGraph(Plot* plot) { | |
| 1233 class RembInterceptingPacketRouter : public PacketRouter { | |
| 1234 public: | |
| 1235 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, | |
| 1236 uint32_t bitrate_bps) override { | |
| 1237 last_bitrate_bps_ = bitrate_bps; | |
| 1238 bitrate_updated_ = true; | |
| 1239 PacketRouter::OnReceiveBitrateChanged(ssrcs, bitrate_bps); | |
| 1240 } | |
| 1241 uint32_t last_bitrate_bps() const { return last_bitrate_bps_; } | |
| 1242 bool GetAndResetBitrateUpdated() { | |
| 1243 bool bitrate_updated = bitrate_updated_; | |
| 1244 bitrate_updated_ = false; | |
| 1245 return bitrate_updated; | |
| 1246 } | |
| 1247 | |
| 1248 private: | |
| 1249 uint32_t last_bitrate_bps_; | |
| 1250 bool bitrate_updated_; | |
| 1251 }; | |
| 1252 | |
| 1253 std::multimap<uint64_t, const LoggedRtpPacket*> incoming_rtp; | |
| 1254 | |
| 1255 for (const auto& kv : rtp_packets_) { | |
| 1256 if (kv.first.GetDirection() == PacketDirection::kIncomingPacket && | |
| 1257 IsVideoSsrc(kv.first)) { | |
| 1258 for (const LoggedRtpPacket& rtp_packet : kv.second) | |
| 1259 incoming_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); | |
| 1260 } | |
| 1261 } | |
| 1262 | |
| 1263 SimulatedClock clock(0); | |
| 1264 RembInterceptingPacketRouter packet_router; | |
| 1265 // TODO(terelius): The PacketRrouter is the used as the RemoteBitrateObserver. | |
| 1266 // Is this intentional? | |
| 1267 ReceiveSideCongestionController rscc(&clock, &packet_router); | |
| 1268 // TODO(holmer): Log the call config and use that here instead. | |
|
philipel
2017/08/17 15:37:48
Why is this TODO(holmer)?
terelius
2017/08/17 15:43:36
Copied from CreateSendSideBweSimulationGraph, line
| |
| 1269 // static const uint32_t kDefaultStartBitrateBps = 300000; | |
| 1270 // rscc.SetBweBitrates(0, kDefaultStartBitrateBps, -1); | |
| 1271 | |
| 1272 TimeSeries time_series("Receive side estimate", LINE_DOT_GRAPH); | |
| 1273 TimeSeries acked_time_series("Received bitrate", LINE_GRAPH); | |
| 1274 | |
| 1275 RateStatistics acked_bitrate(250, 8000); | |
| 1276 int64_t last_update_us = 0; | |
| 1277 for (const auto& kv : incoming_rtp) { | |
| 1278 const LoggedRtpPacket& packet = *kv.second; | |
| 1279 int64_t arrival_time_ms = packet.timestamp / 1000; | |
| 1280 size_t payload = packet.total_length; /*Should subtract header?*/ | |
| 1281 clock.AdvanceTimeMicroseconds(packet.timestamp - | |
| 1282 clock.TimeInMicroseconds()); | |
| 1283 rscc.OnReceivedPacket(arrival_time_ms, payload, packet.header); | |
| 1284 acked_bitrate.Update(payload, arrival_time_ms); | |
| 1285 rtc::Optional<uint32_t> bitrate_bps = acked_bitrate.Rate(arrival_time_ms); | |
| 1286 if (bitrate_bps) { | |
| 1287 uint32_t y = *bitrate_bps / 1000; | |
| 1288 float x = static_cast<float>(clock.TimeInMicroseconds() - begin_time_) / | |
| 1289 1000000; | |
| 1290 acked_time_series.points.emplace_back(x, y); | |
| 1291 } | |
| 1292 if (packet_router.GetAndResetBitrateUpdated() || | |
| 1293 clock.TimeInMicroseconds() - last_update_us >= 1e6) { | |
| 1294 uint32_t y = packet_router.last_bitrate_bps() / 1000; | |
| 1295 float x = static_cast<float>(clock.TimeInMicroseconds() - begin_time_) / | |
| 1296 1000000; | |
| 1297 time_series.points.emplace_back(x, y); | |
| 1298 last_update_us = clock.TimeInMicroseconds(); | |
| 1299 } | |
| 1300 } | |
| 1301 // Add the data set to the plot. | |
| 1302 plot->AppendTimeSeries(std::move(time_series)); | |
| 1303 plot->AppendTimeSeries(std::move(acked_time_series)); | |
| 1304 | |
| 1305 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | |
| 1306 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); | |
| 1307 plot->SetTitle("Simulated receive-side BWE behavior"); | |
| 1230 } | 1308 } |
| 1231 | 1309 |
| 1232 void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { | 1310 void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { |
| 1233 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp; | 1311 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp; |
| 1234 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp; | 1312 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp; |
| 1235 | 1313 |
| 1236 for (const auto& kv : rtp_packets_) { | 1314 for (const auto& kv : rtp_packets_) { |
| 1237 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) { | 1315 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) { |
| 1238 for (const LoggedRtpPacket& rtp_packet : kv.second) | 1316 for (const LoggedRtpPacket& rtp_packet : kv.second) |
| 1239 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); | 1317 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1722 plot->AppendTimeSeries(std::move(series.second)); | 1800 plot->AppendTimeSeries(std::move(series.second)); |
| 1723 } | 1801 } |
| 1724 | 1802 |
| 1725 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1803 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1726 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin, | 1804 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin, |
| 1727 kTopMargin); | 1805 kTopMargin); |
| 1728 plot->SetTitle("NetEq timing"); | 1806 plot->SetTitle("NetEq timing"); |
| 1729 } | 1807 } |
| 1730 } // namespace plotting | 1808 } // namespace plotting |
| 1731 } // namespace webrtc | 1809 } // namespace webrtc |
| OLD | NEW |