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 12 matching lines...) Expand all Loading... |
23 #include "webrtc/call/audio_receive_stream.h" | 23 #include "webrtc/call/audio_receive_stream.h" |
24 #include "webrtc/call/audio_send_stream.h" | 24 #include "webrtc/call/audio_send_stream.h" |
25 #include "webrtc/call/call.h" | 25 #include "webrtc/call/call.h" |
26 #include "webrtc/common_types.h" | 26 #include "webrtc/common_types.h" |
27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" | 27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
28 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 28 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
29 #include "webrtc/modules/include/module_common_types.h" | 29 #include "webrtc/modules/include/module_common_types.h" |
30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
31 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 31 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" | 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" |
| 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" |
| 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
34 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" |
35 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 37 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
36 #include "webrtc/video_receive_stream.h" | 38 #include "webrtc/video_receive_stream.h" |
37 #include "webrtc/video_send_stream.h" | 39 #include "webrtc/video_send_stream.h" |
38 | 40 |
39 namespace webrtc { | 41 namespace webrtc { |
40 namespace plotting { | 42 namespace plotting { |
41 | 43 |
42 namespace { | 44 namespace { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 break; | 380 break; |
379 } | 381 } |
380 case ParsedRtcEventLog::RTCP_EVENT: { | 382 case ParsedRtcEventLog::RTCP_EVENT: { |
381 uint8_t packet[IP_PACKET_SIZE]; | 383 uint8_t packet[IP_PACKET_SIZE]; |
382 MediaType media_type; | 384 MediaType media_type; |
383 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, | 385 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, |
384 &total_length); | 386 &total_length); |
385 | 387 |
386 // Currently feedback is logged twice, both for audio and video. | 388 // Currently feedback is logged twice, both for audio and video. |
387 // Only act on one of them. | 389 // Only act on one of them. |
388 if (media_type == MediaType::VIDEO) { | 390 if (media_type == MediaType::AUDIO || media_type == MediaType::ANY) { |
389 rtcp::CommonHeader header; | 391 rtcp::CommonHeader header; |
390 const uint8_t* packet_end = packet + total_length; | 392 const uint8_t* packet_end = packet + total_length; |
391 for (const uint8_t* block = packet; block < packet_end; | 393 for (const uint8_t* block = packet; block < packet_end; |
392 block = header.NextPacket()) { | 394 block = header.NextPacket()) { |
393 RTC_CHECK(header.Parse(block, packet_end - block)); | 395 RTC_CHECK(header.Parse(block, packet_end - block)); |
394 if (header.type() == rtcp::TransportFeedback::kPacketType && | 396 if (header.type() == rtcp::TransportFeedback::kPacketType && |
395 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { | 397 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { |
396 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet( | 398 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet( |
397 new rtcp::TransportFeedback()); | 399 new rtcp::TransportFeedback()); |
398 if (rtcp_packet->Parse(header)) { | 400 if (rtcp_packet->Parse(header)) { |
399 uint32_t ssrc = rtcp_packet->sender_ssrc(); | 401 uint32_t ssrc = rtcp_packet->sender_ssrc(); |
400 StreamId stream(ssrc, direction); | 402 StreamId stream(ssrc, direction); |
401 uint64_t timestamp = parsed_log_.GetTimestamp(i); | 403 uint64_t timestamp = parsed_log_.GetTimestamp(i); |
402 rtcp_packets_[stream].push_back(LoggedRtcpPacket( | 404 rtcp_packets_[stream].push_back(LoggedRtcpPacket( |
403 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet))); | 405 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet))); |
404 } | 406 } |
| 407 } else if (header.type() == rtcp::SenderReport::kPacketType) { |
| 408 std::unique_ptr<rtcp::SenderReport> rtcp_packet( |
| 409 new rtcp::SenderReport()); |
| 410 if (rtcp_packet->Parse(header)) { |
| 411 uint32_t ssrc = rtcp_packet->sender_ssrc(); |
| 412 StreamId stream(ssrc, direction); |
| 413 uint64_t timestamp = parsed_log_.GetTimestamp(i); |
| 414 rtcp_packets_[stream].push_back(LoggedRtcpPacket( |
| 415 timestamp, kRtcpSr, std::move(rtcp_packet))); |
| 416 } |
| 417 } else if (header.type() == rtcp::ReceiverReport::kPacketType) { |
| 418 std::unique_ptr<rtcp::ReceiverReport> rtcp_packet( |
| 419 new rtcp::ReceiverReport()); |
| 420 if (rtcp_packet->Parse(header)) { |
| 421 uint32_t ssrc = rtcp_packet->sender_ssrc(); |
| 422 StreamId stream(ssrc, direction); |
| 423 uint64_t timestamp = parsed_log_.GetTimestamp(i); |
| 424 rtcp_packets_[stream].push_back(LoggedRtcpPacket( |
| 425 timestamp, kRtcpRr, std::move(rtcp_packet))); |
| 426 } |
405 } | 427 } |
406 } | 428 } |
407 } | 429 } |
408 break; | 430 break; |
409 } | 431 } |
410 case ParsedRtcEventLog::LOG_START: { | 432 case ParsedRtcEventLog::LOG_START: { |
411 break; | 433 break; |
412 } | 434 } |
413 case ParsedRtcEventLog::LOG_END: { | 435 case ParsedRtcEventLog::LOG_END: { |
414 break; | 436 break; |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 for (auto& packet : *largest_video_stream) { | 1224 for (auto& packet : *largest_video_stream) { |
1203 if (packet.header.markerBit) { | 1225 if (packet.header.markerBit) { |
1204 int64_t capture_ms = packet.header.timestamp / 90.0; | 1226 int64_t capture_ms = packet.header.timestamp / 90.0; |
1205 int64_t arrival_ms = packet.timestamp / 1000.0; | 1227 int64_t arrival_ms = packet.timestamp / 1000.0; |
1206 timestamps.push_back(std::make_pair(capture_ms, arrival_ms)); | 1228 timestamps.push_back(std::make_pair(capture_ms, arrival_ms)); |
1207 } | 1229 } |
1208 } | 1230 } |
1209 } | 1231 } |
1210 return timestamps; | 1232 return timestamps; |
1211 } | 1233 } |
| 1234 |
| 1235 void EventLogAnalyzer::CreateTimestampGraph(Plot* plot) { |
| 1236 for (const auto& kv : rtp_packets_) { |
| 1237 const std::vector<LoggedRtpPacket>& rtp_packets = kv.second; |
| 1238 StreamId stream_id = kv.first; |
| 1239 |
| 1240 { |
| 1241 TimeSeries timestamp_data; |
| 1242 timestamp_data.label = GetStreamName(stream_id) + " capture-time"; |
| 1243 timestamp_data.style = LINE_DOT_GRAPH; |
| 1244 for (LoggedRtpPacket packet : rtp_packets) { |
| 1245 float x = static_cast<float>(packet.timestamp - begin_time_) / 1000000; |
| 1246 float y = packet.header.timestamp; |
| 1247 timestamp_data.points.emplace_back(x, y); |
| 1248 } |
| 1249 plot->series_list_.push_back(std::move(timestamp_data)); |
| 1250 } |
| 1251 |
| 1252 { |
| 1253 auto kv = rtcp_packets_.find(stream_id); |
| 1254 if (kv != rtcp_packets_.end()) { |
| 1255 const auto& packets = kv->second; |
| 1256 TimeSeries timestamp_data; |
| 1257 timestamp_data.label = GetStreamName(stream_id) + " rtcp capture-time"; |
| 1258 timestamp_data.style = LINE_DOT_GRAPH; |
| 1259 for (const LoggedRtcpPacket& rtcp : packets) { |
| 1260 if (rtcp.type != kRtcpSr) |
| 1261 continue; |
| 1262 rtcp::SenderReport* sr; |
| 1263 sr = static_cast<rtcp::SenderReport*>(rtcp.packet.get()); |
| 1264 float x = static_cast<float>(rtcp.timestamp - begin_time_) / 1000000; |
| 1265 float y = sr->rtp_timestamp(); |
| 1266 timestamp_data.points.emplace_back(x, y); |
| 1267 } |
| 1268 plot->series_list_.push_back(std::move(timestamp_data)); |
| 1269 } |
| 1270 } |
| 1271 } |
| 1272 |
| 1273 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1274 plot->SetSuggestedYAxis(0, 1, "Timestamp (90khz)", kBottomMargin, kTopMargin); |
| 1275 plot->SetTitle("Timestamps"); |
| 1276 } |
1212 } // namespace plotting | 1277 } // namespace plotting |
1213 } // namespace webrtc | 1278 } // namespace webrtc |
OLD | NEW |