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 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 if (kv.first.GetDirection() == PacketDirection::kIncomingPacket) { | 1240 if (kv.first.GetDirection() == PacketDirection::kIncomingPacket) { |
1241 for (const LoggedRtcpPacket& rtcp_packet : kv.second) | 1241 for (const LoggedRtcpPacket& rtcp_packet : kv.second) |
1242 incoming_rtcp.insert( | 1242 incoming_rtcp.insert( |
1243 std::make_pair(rtcp_packet.timestamp, &rtcp_packet)); | 1243 std::make_pair(rtcp_packet.timestamp, &rtcp_packet)); |
1244 } | 1244 } |
1245 } | 1245 } |
1246 | 1246 |
1247 SimulatedClock clock(0); | 1247 SimulatedClock clock(0); |
1248 TransportFeedbackAdapter feedback_adapter(&clock); | 1248 TransportFeedbackAdapter feedback_adapter(&clock); |
1249 | 1249 |
| 1250 TimeSeries late_feedback_series("Late feedback results.", DOT_GRAPH); |
1250 TimeSeries time_series("Network Delay Change", LINE_DOT_GRAPH); | 1251 TimeSeries time_series("Network Delay Change", LINE_DOT_GRAPH); |
1251 int64_t estimated_base_delay_ms = std::numeric_limits<int64_t>::max(); | 1252 int64_t estimated_base_delay_ms = std::numeric_limits<int64_t>::max(); |
1252 | 1253 |
1253 auto rtp_iterator = outgoing_rtp.begin(); | 1254 auto rtp_iterator = outgoing_rtp.begin(); |
1254 auto rtcp_iterator = incoming_rtcp.begin(); | 1255 auto rtcp_iterator = incoming_rtcp.begin(); |
1255 | 1256 |
1256 auto NextRtpTime = [&]() { | 1257 auto NextRtpTime = [&]() { |
1257 if (rtp_iterator != outgoing_rtp.end()) | 1258 if (rtp_iterator != outgoing_rtp.end()) |
1258 return static_cast<int64_t>(rtp_iterator->first); | 1259 return static_cast<int64_t>(rtp_iterator->first); |
1259 return std::numeric_limits<int64_t>::max(); | 1260 return std::numeric_limits<int64_t>::max(); |
1260 }; | 1261 }; |
1261 | 1262 |
1262 auto NextRtcpTime = [&]() { | 1263 auto NextRtcpTime = [&]() { |
1263 if (rtcp_iterator != incoming_rtcp.end()) | 1264 if (rtcp_iterator != incoming_rtcp.end()) |
1264 return static_cast<int64_t>(rtcp_iterator->first); | 1265 return static_cast<int64_t>(rtcp_iterator->first); |
1265 return std::numeric_limits<int64_t>::max(); | 1266 return std::numeric_limits<int64_t>::max(); |
1266 }; | 1267 }; |
1267 | 1268 |
1268 int64_t time_us = std::min(NextRtpTime(), NextRtcpTime()); | 1269 int64_t time_us = std::min(NextRtpTime(), NextRtcpTime()); |
| 1270 int64_t prev_y = 0; |
1269 while (time_us != std::numeric_limits<int64_t>::max()) { | 1271 while (time_us != std::numeric_limits<int64_t>::max()) { |
1270 clock.AdvanceTimeMicroseconds(time_us - clock.TimeInMicroseconds()); | 1272 clock.AdvanceTimeMicroseconds(time_us - clock.TimeInMicroseconds()); |
1271 if (clock.TimeInMicroseconds() >= NextRtcpTime()) { | 1273 if (clock.TimeInMicroseconds() >= NextRtcpTime()) { |
1272 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextRtcpTime()); | 1274 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextRtcpTime()); |
1273 const LoggedRtcpPacket& rtcp = *rtcp_iterator->second; | 1275 const LoggedRtcpPacket& rtcp = *rtcp_iterator->second; |
1274 if (rtcp.type == kRtcpTransportFeedback) { | 1276 if (rtcp.type == kRtcpTransportFeedback) { |
1275 feedback_adapter.OnTransportFeedback( | 1277 feedback_adapter.OnTransportFeedback( |
1276 *static_cast<rtcp::TransportFeedback*>(rtcp.packet.get())); | 1278 *static_cast<rtcp::TransportFeedback*>(rtcp.packet.get())); |
1277 std::vector<PacketFeedback> feedback = | 1279 std::vector<PacketFeedback> feedback = |
1278 feedback_adapter.GetTransportFeedbackVector(); | 1280 feedback_adapter.GetTransportFeedbackVector(); |
1279 SortPacketFeedbackVector(&feedback); | 1281 SortPacketFeedbackVector(&feedback); |
1280 for (const PacketFeedback& packet : feedback) { | 1282 for (const PacketFeedback& packet : feedback) { |
1281 int64_t y = packet.arrival_time_ms - packet.send_time_ms; | |
1282 float x = | 1283 float x = |
1283 static_cast<float>(clock.TimeInMicroseconds() - begin_time_) / | 1284 static_cast<float>(clock.TimeInMicroseconds() - begin_time_) / |
1284 1000000; | 1285 1000000; |
| 1286 if (packet.send_time_ms == -1) { |
| 1287 late_feedback_series.points.emplace_back(x, prev_y); |
| 1288 continue; |
| 1289 } |
| 1290 int64_t y = packet.arrival_time_ms - packet.send_time_ms; |
| 1291 prev_y = y; |
1285 estimated_base_delay_ms = std::min(y, estimated_base_delay_ms); | 1292 estimated_base_delay_ms = std::min(y, estimated_base_delay_ms); |
1286 time_series.points.emplace_back(x, y); | 1293 time_series.points.emplace_back(x, y); |
1287 } | 1294 } |
1288 } | 1295 } |
1289 ++rtcp_iterator; | 1296 ++rtcp_iterator; |
1290 } | 1297 } |
1291 if (clock.TimeInMicroseconds() >= NextRtpTime()) { | 1298 if (clock.TimeInMicroseconds() >= NextRtpTime()) { |
1292 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextRtpTime()); | 1299 RTC_DCHECK_EQ(clock.TimeInMicroseconds(), NextRtpTime()); |
1293 const LoggedRtpPacket& rtp = *rtp_iterator->second; | 1300 const LoggedRtpPacket& rtp = *rtp_iterator->second; |
1294 if (rtp.header.extension.hasTransportSequenceNumber) { | 1301 if (rtp.header.extension.hasTransportSequenceNumber) { |
1295 RTC_DCHECK(rtp.header.extension.hasTransportSequenceNumber); | 1302 RTC_DCHECK(rtp.header.extension.hasTransportSequenceNumber); |
1296 feedback_adapter.AddPacket(rtp.header.ssrc, | 1303 feedback_adapter.AddPacket(rtp.header.ssrc, |
1297 rtp.header.extension.transportSequenceNumber, | 1304 rtp.header.extension.transportSequenceNumber, |
1298 rtp.total_length, PacedPacketInfo()); | 1305 rtp.total_length, PacedPacketInfo()); |
1299 feedback_adapter.OnSentPacket( | 1306 feedback_adapter.OnSentPacket( |
1300 rtp.header.extension.transportSequenceNumber, rtp.timestamp / 1000); | 1307 rtp.header.extension.transportSequenceNumber, rtp.timestamp / 1000); |
1301 } | 1308 } |
1302 ++rtp_iterator; | 1309 ++rtp_iterator; |
1303 } | 1310 } |
1304 time_us = std::min(NextRtpTime(), NextRtcpTime()); | 1311 time_us = std::min(NextRtpTime(), NextRtcpTime()); |
1305 } | 1312 } |
1306 // We assume that the base network delay (w/o queues) is the min delay | 1313 // We assume that the base network delay (w/o queues) is the min delay |
1307 // observed during the call. | 1314 // observed during the call. |
1308 for (TimeSeriesPoint& point : time_series.points) | 1315 for (TimeSeriesPoint& point : time_series.points) |
1309 point.y -= estimated_base_delay_ms; | 1316 point.y -= estimated_base_delay_ms; |
| 1317 for (TimeSeriesPoint& point : late_feedback_series.points) |
| 1318 point.y -= estimated_base_delay_ms; |
1310 // Add the data set to the plot. | 1319 // Add the data set to the plot. |
1311 plot->AppendTimeSeries(std::move(time_series)); | 1320 plot->AppendTimeSeriesIfNotEmpty(std::move(time_series)); |
| 1321 plot->AppendTimeSeriesIfNotEmpty(std::move(late_feedback_series)); |
1312 | 1322 |
1313 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1323 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
1314 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); | 1324 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); |
1315 plot->SetTitle("Network Delay Change."); | 1325 plot->SetTitle("Network Delay Change."); |
1316 } | 1326 } |
1317 | 1327 |
1318 std::vector<std::pair<int64_t, int64_t>> EventLogAnalyzer::GetFrameTimestamps() | 1328 std::vector<std::pair<int64_t, int64_t>> EventLogAnalyzer::GetFrameTimestamps() |
1319 const { | 1329 const { |
1320 std::vector<std::pair<int64_t, int64_t>> timestamps; | 1330 std::vector<std::pair<int64_t, int64_t>> timestamps; |
1321 size_t largest_stream_size = 0; | 1331 size_t largest_stream_size = 0; |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 plot->AppendTimeSeries(std::move(series.second)); | 1728 plot->AppendTimeSeries(std::move(series.second)); |
1719 } | 1729 } |
1720 | 1730 |
1721 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1731 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
1722 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin, | 1732 plot->SetYAxis(min_y_axis, max_y_axis, "Relative delay (ms)", kBottomMargin, |
1723 kTopMargin); | 1733 kTopMargin); |
1724 plot->SetTitle("NetEq timing"); | 1734 plot->SetTitle("NetEq timing"); |
1725 } | 1735 } |
1726 } // namespace plotting | 1736 } // namespace plotting |
1727 } // namespace webrtc | 1737 } // namespace webrtc |
OLD | NEW |