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

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

Issue 2986683002: Add simulation of receive-side bandwidth estimate to event_log_analyzer
Patch Set: Rebase Created 3 years, 3 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
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 11 matching lines...) Expand all
22 #include "webrtc/call/call.h" 22 #include "webrtc/call/call.h"
23 #include "webrtc/call/video_receive_stream.h" 23 #include "webrtc/call/video_receive_stream.h"
24 #include "webrtc/call/video_send_stream.h" 24 #include "webrtc/call/video_send_stream.h"
25 #include "webrtc/common_types.h" 25 #include "webrtc/common_types.h"
26 #include "webrtc/modules/audio_coding/neteq/tools/audio_sink.h" 26 #include "webrtc/modules/audio_coding/neteq/tools/audio_sink.h"
27 #include "webrtc/modules/audio_coding/neteq/tools/fake_decode_from_file.h" 27 #include "webrtc/modules/audio_coding/neteq/tools/fake_decode_from_file.h"
28 #include "webrtc/modules/audio_coding/neteq/tools/neteq_delay_analyzer.h" 28 #include "webrtc/modules/audio_coding/neteq/tools/neteq_delay_analyzer.h"
29 #include "webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.h" 29 #include "webrtc/modules/audio_coding/neteq/tools/neteq_replacement_input.h"
30 #include "webrtc/modules/audio_coding/neteq/tools/neteq_test.h" 30 #include "webrtc/modules/audio_coding/neteq/tools/neteq_test.h"
31 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" 31 #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h"
32 #include "webrtc/modules/congestion_controller/include/receive_side_congestion_c ontroller.h"
32 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont roller.h" 33 #include "webrtc/modules/congestion_controller/include/send_side_congestion_cont roller.h"
33 #include "webrtc/modules/include/module_common_types.h" 34 #include "webrtc/modules/include/module_common_types.h"
34 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 35 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
35 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 36 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
36 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" 37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
37 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 38 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
38 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h" 39 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/remb.h"
39 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" 40 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
40 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 41 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
41 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 42 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 1097
1097 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1098 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1098 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin); 1099 plot->SetSuggestedYAxis(0, 1, "Bitrate (kbps)", kBottomMargin, kTopMargin);
1099 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) { 1100 if (desired_direction == webrtc::PacketDirection::kIncomingPacket) {
1100 plot->SetTitle("Incoming bitrate per stream"); 1101 plot->SetTitle("Incoming bitrate per stream");
1101 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) { 1102 } else if (desired_direction == webrtc::PacketDirection::kOutgoingPacket) {
1102 plot->SetTitle("Outgoing bitrate per stream"); 1103 plot->SetTitle("Outgoing bitrate per stream");
1103 } 1104 }
1104 } 1105 }
1105 1106
1106 void EventLogAnalyzer::CreateBweSimulationGraph(Plot* plot) { 1107 void EventLogAnalyzer::CreateSendSideBweSimulationGraph(Plot* plot) {
1107 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp; 1108 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp;
1108 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp; 1109 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp;
1109 1110
1110 for (const auto& kv : rtp_packets_) { 1111 for (const auto& kv : rtp_packets_) {
1111 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) { 1112 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) {
1112 for (const LoggedRtpPacket& rtp_packet : kv.second) 1113 for (const LoggedRtpPacket& rtp_packet : kv.second)
1113 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); 1114 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet));
1114 } 1115 }
1115 } 1116 }
1116 1117
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 last_update_us = time_us; 1216 last_update_us = time_us;
1216 } 1217 }
1217 time_us = std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()}); 1218 time_us = std::min({NextRtpTime(), NextRtcpTime(), NextProcessTime()});
1218 } 1219 }
1219 // Add the data set to the plot. 1220 // Add the data set to the plot.
1220 plot->AppendTimeSeries(std::move(time_series)); 1221 plot->AppendTimeSeries(std::move(time_series));
1221 plot->AppendTimeSeries(std::move(acked_time_series)); 1222 plot->AppendTimeSeries(std::move(acked_time_series));
1222 1223
1223 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1224 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1224 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin); 1225 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin);
1225 plot->SetTitle("Simulated BWE behavior"); 1226 plot->SetTitle("Simulated send-side BWE behavior");
1227 }
1228
1229 void EventLogAnalyzer::CreateReceiveSideBweSimulationGraph(Plot* plot) {
1230 class RembInterceptingPacketRouter : public PacketRouter {
1231 public:
1232 void OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
1233 uint32_t bitrate_bps) override {
1234 last_bitrate_bps_ = bitrate_bps;
1235 bitrate_updated_ = true;
1236 PacketRouter::OnReceiveBitrateChanged(ssrcs, bitrate_bps);
1237 }
1238 uint32_t last_bitrate_bps() const { return last_bitrate_bps_; }
1239 bool GetAndResetBitrateUpdated() {
1240 bool bitrate_updated = bitrate_updated_;
1241 bitrate_updated_ = false;
1242 return bitrate_updated;
1243 }
1244
1245 private:
1246 uint32_t last_bitrate_bps_;
1247 bool bitrate_updated_;
1248 };
1249
1250 std::multimap<uint64_t, const LoggedRtpPacket*> incoming_rtp;
1251
1252 for (const auto& kv : rtp_packets_) {
1253 if (kv.first.GetDirection() == PacketDirection::kIncomingPacket &&
1254 IsVideoSsrc(kv.first)) {
1255 for (const LoggedRtpPacket& rtp_packet : kv.second)
1256 incoming_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet));
1257 }
1258 }
1259
1260 SimulatedClock clock(0);
1261 RembInterceptingPacketRouter packet_router;
1262 // TODO(terelius): The PacketRrouter is the used as the RemoteBitrateObserver.
1263 // Is this intentional?
1264 ReceiveSideCongestionController rscc(&clock, &packet_router);
1265 // TODO(holmer): Log the call config and use that here instead.
1266 // static const uint32_t kDefaultStartBitrateBps = 300000;
1267 // rscc.SetBweBitrates(0, kDefaultStartBitrateBps, -1);
1268
1269 TimeSeries time_series("Receive side estimate", LINE_DOT_GRAPH);
1270 TimeSeries acked_time_series("Received bitrate", LINE_GRAPH);
1271
1272 RateStatistics acked_bitrate(250, 8000);
1273 int64_t last_update_us = 0;
1274 for (const auto& kv : incoming_rtp) {
1275 const LoggedRtpPacket& packet = *kv.second;
1276 int64_t arrival_time_ms = packet.timestamp / 1000;
1277 size_t payload = packet.total_length; /*Should subtract header?*/
1278 clock.AdvanceTimeMicroseconds(packet.timestamp -
1279 clock.TimeInMicroseconds());
1280 rscc.OnReceivedPacket(arrival_time_ms, payload, packet.header);
1281 acked_bitrate.Update(payload, arrival_time_ms);
1282 rtc::Optional<uint32_t> bitrate_bps = acked_bitrate.Rate(arrival_time_ms);
1283 if (bitrate_bps) {
1284 uint32_t y = *bitrate_bps / 1000;
1285 float x = static_cast<float>(clock.TimeInMicroseconds() - begin_time_) /
1286 1000000;
1287 acked_time_series.points.emplace_back(x, y);
1288 }
1289 if (packet_router.GetAndResetBitrateUpdated() ||
1290 clock.TimeInMicroseconds() - last_update_us >= 1e6) {
1291 uint32_t y = packet_router.last_bitrate_bps() / 1000;
1292 float x = static_cast<float>(clock.TimeInMicroseconds() - begin_time_) /
1293 1000000;
1294 time_series.points.emplace_back(x, y);
1295 last_update_us = clock.TimeInMicroseconds();
1296 }
1297 }
1298 // Add the data set to the plot.
1299 plot->AppendTimeSeries(std::move(time_series));
1300 plot->AppendTimeSeries(std::move(acked_time_series));
1301
1302 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1303 plot->SetSuggestedYAxis(0, 10, "Bitrate (kbps)", kBottomMargin, kTopMargin);
1304 plot->SetTitle("Simulated receive-side BWE behavior");
1226 } 1305 }
1227 1306
1228 void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) { 1307 void EventLogAnalyzer::CreateNetworkDelayFeedbackGraph(Plot* plot) {
1229 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp; 1308 std::multimap<uint64_t, const LoggedRtpPacket*> outgoing_rtp;
1230 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp; 1309 std::multimap<uint64_t, const LoggedRtcpPacket*> incoming_rtcp;
1231 1310
1232 for (const auto& kv : rtp_packets_) { 1311 for (const auto& kv : rtp_packets_) {
1233 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) { 1312 if (kv.first.GetDirection() == PacketDirection::kOutgoingPacket) {
1234 for (const LoggedRtpPacket& rtp_packet : kv.second) 1313 for (const LoggedRtpPacket& rtp_packet : kv.second)
1235 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet)); 1314 outgoing_rtp.insert(std::make_pair(rtp_packet.timestamp, &rtp_packet));
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 plot->AppendTimeSeries(std::move(series.second)); 1797 plot->AppendTimeSeries(std::move(series.second));
1719 } 1798 }
1720 1799
1721 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1800 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1722 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin, 1801 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin,
1723 kTopMargin); 1802 kTopMargin);
1724 plot->SetTitle("NetEq timing"); 1803 plot->SetTitle("NetEq timing");
1725 } 1804 }
1726 } // namespace plotting 1805 } // namespace plotting
1727 } // namespace webrtc 1806 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/rtc_tools/event_log_visualizer/analyzer.h ('k') | webrtc/rtc_tools/event_log_visualizer/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698