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 11 matching lines...) Expand all Loading... | |
22 #include "webrtc/base/rate_statistics.h" | 22 #include "webrtc/base/rate_statistics.h" |
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/rtp_rtcp/include/rtp_rtcp.h" | 29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" | 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" | |
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" | |
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
33 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" |
34 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
35 #include "webrtc/video_receive_stream.h" | 37 #include "webrtc/video_receive_stream.h" |
36 #include "webrtc/video_send_stream.h" | 38 #include "webrtc/video_send_stream.h" |
37 | 39 |
38 namespace webrtc { | 40 namespace webrtc { |
39 namespace plotting { | 41 namespace plotting { |
40 | 42 |
41 namespace { | 43 namespace { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 break; | 381 break; |
380 } | 382 } |
381 case ParsedRtcEventLog::RTCP_EVENT: { | 383 case ParsedRtcEventLog::RTCP_EVENT: { |
382 uint8_t packet[IP_PACKET_SIZE]; | 384 uint8_t packet[IP_PACKET_SIZE]; |
383 MediaType media_type; | 385 MediaType media_type; |
384 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, | 386 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, |
385 &total_length); | 387 &total_length); |
386 | 388 |
387 // Currently feedback is logged twice, both for audio and video. | 389 // Currently feedback is logged twice, both for audio and video. |
388 // Only act on one of them. | 390 // Only act on one of them. |
389 if (media_type == MediaType::VIDEO) { | 391 if (media_type == MediaType::AUDIO || media_type == MediaType::ANY) { |
terelius
2017/02/01 13:29:31
Won't this mean that we do act on the same RTCP re
stefan-webrtc
2017/02/02 13:19:17
No. ANY basically means that the packet is logged
terelius
2017/02/02 13:45:56
Acknowledged.
| |
390 rtcp::CommonHeader header; | 392 rtcp::CommonHeader header; |
391 const uint8_t* packet_end = packet + total_length; | 393 const uint8_t* packet_end = packet + total_length; |
392 for (const uint8_t* block = packet; block < packet_end; | 394 for (const uint8_t* block = packet; block < packet_end; |
393 block = header.NextPacket()) { | 395 block = header.NextPacket()) { |
394 RTC_CHECK(header.Parse(block, packet_end - block)); | 396 RTC_CHECK(header.Parse(block, packet_end - block)); |
395 if (header.type() == rtcp::TransportFeedback::kPacketType && | 397 if (header.type() == rtcp::TransportFeedback::kPacketType && |
396 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { | 398 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { |
397 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet( | 399 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet( |
398 new rtcp::TransportFeedback()); | 400 new rtcp::TransportFeedback()); |
399 if (rtcp_packet->Parse(header)) { | 401 if (rtcp_packet->Parse(header)) { |
400 uint32_t ssrc = rtcp_packet->sender_ssrc(); | 402 uint32_t ssrc = rtcp_packet->sender_ssrc(); |
401 StreamId stream(ssrc, direction); | 403 StreamId stream(ssrc, direction); |
402 uint64_t timestamp = parsed_log_.GetTimestamp(i); | 404 uint64_t timestamp = parsed_log_.GetTimestamp(i); |
403 rtcp_packets_[stream].push_back(LoggedRtcpPacket( | 405 rtcp_packets_[stream].push_back(LoggedRtcpPacket( |
404 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet))); | 406 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet))); |
405 } | 407 } |
408 } else if (header.type() == rtcp::SenderReport::kPacketType) { | |
409 std::unique_ptr<rtcp::SenderReport> rtcp_packet( | |
410 new rtcp::SenderReport()); | |
411 if (rtcp_packet->Parse(header)) { | |
412 uint32_t ssrc = rtcp_packet->sender_ssrc(); | |
413 StreamId stream(ssrc, direction); | |
414 uint64_t timestamp = parsed_log_.GetTimestamp(i); | |
415 rtcp_packets_[stream].push_back(LoggedRtcpPacket( | |
416 timestamp, kRtcpSr, std::move(rtcp_packet))); | |
417 } | |
418 } else if (header.type() == rtcp::ReceiverReport::kPacketType) { | |
419 std::unique_ptr<rtcp::ReceiverReport> rtcp_packet( | |
420 new rtcp::ReceiverReport()); | |
421 if (rtcp_packet->Parse(header)) { | |
422 uint32_t ssrc = rtcp_packet->sender_ssrc(); | |
423 StreamId stream(ssrc, direction); | |
424 uint64_t timestamp = parsed_log_.GetTimestamp(i); | |
425 rtcp_packets_[stream].push_back(LoggedRtcpPacket( | |
426 timestamp, kRtcpRr, std::move(rtcp_packet))); | |
427 } | |
406 } | 428 } |
407 } | 429 } |
408 } | 430 } |
409 break; | 431 break; |
410 } | 432 } |
411 case ParsedRtcEventLog::LOG_START: { | 433 case ParsedRtcEventLog::LOG_START: { |
412 break; | 434 break; |
413 } | 435 } |
414 case ParsedRtcEventLog::LOG_END: { | 436 case ParsedRtcEventLog::LOG_END: { |
415 break; | 437 break; |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1191 for (auto& packet : *largest_video_stream) { | 1213 for (auto& packet : *largest_video_stream) { |
1192 if (packet.header.markerBit) { | 1214 if (packet.header.markerBit) { |
1193 int64_t capture_ms = packet.header.timestamp / 90.0; | 1215 int64_t capture_ms = packet.header.timestamp / 90.0; |
1194 int64_t arrival_ms = packet.timestamp / 1000.0; | 1216 int64_t arrival_ms = packet.timestamp / 1000.0; |
1195 timestamps.push_back(std::make_pair(capture_ms, arrival_ms)); | 1217 timestamps.push_back(std::make_pair(capture_ms, arrival_ms)); |
1196 } | 1218 } |
1197 } | 1219 } |
1198 } | 1220 } |
1199 return timestamps; | 1221 return timestamps; |
1200 } | 1222 } |
1223 | |
1224 void EventLogAnalyzer::CreateTimestampGraph(Plot* plot) { | |
1225 for (const auto& kv : rtp_packets_) { | |
1226 const std::vector<LoggedRtpPacket>& rtp_packets = kv.second; | |
1227 StreamId stream_id = kv.first; | |
1228 | |
1229 { | |
1230 TimeSeries timestamp_data; | |
1231 timestamp_data.label = GetStreamName(stream_id) + " capture-time"; | |
1232 timestamp_data.style = LINE_DOT_GRAPH; | |
1233 rtc::Optional<uint32_t> first_timestamp; | |
1234 for (LoggedRtpPacket packet : rtp_packets) { | |
1235 float x = static_cast<float>(packet.timestamp - begin_time_) / 1000000; | |
1236 if (!first_timestamp) | |
1237 first_timestamp = rtc::Optional<uint32_t>(packet.header.timestamp); | |
terelius
2017/02/02 13:45:56
Are we using first_timestamp anywhere?
stefan-webrtc
2017/02/02 15:00:37
Done.
| |
1238 float y = packet.header.timestamp; | |
1239 timestamp_data.points.emplace_back(x, y); | |
1240 } | |
1241 plot->series_list_.push_back(std::move(timestamp_data)); | |
1242 } | |
1243 | |
1244 { | |
1245 auto kv = rtcp_packets_.find(stream_id); | |
1246 if (kv != rtcp_packets_.end()) { | |
1247 const auto& packets = kv->second; | |
1248 TimeSeries timestamp_data; | |
1249 timestamp_data.label = GetStreamName(stream_id) + " rtcp capture-time"; | |
1250 timestamp_data.style = LINE_DOT_GRAPH; | |
1251 rtc::Optional<uint32_t> first_timestamp; | |
1252 for (const LoggedRtcpPacket& rtcp : packets) { | |
1253 if (rtcp.type != kRtcpSr) | |
1254 continue; | |
1255 rtcp::SenderReport* sr; | |
1256 sr = static_cast<rtcp::SenderReport*>(rtcp.packet.get()); | |
1257 float x = static_cast<float>(rtcp.timestamp - begin_time_) / 1000000; | |
1258 if (!first_timestamp) | |
1259 first_timestamp = rtc::Optional<uint32_t>(sr->rtp_timestamp()); | |
terelius
2017/02/02 13:45:56
Are we using first_timestamp anywhere?
stefan-webrtc
2017/02/02 15:00:37
Good point, no!
| |
1260 float y = sr->rtp_timestamp(); | |
1261 timestamp_data.points.emplace_back(x, y); | |
1262 } | |
1263 plot->series_list_.push_back(std::move(timestamp_data)); | |
1264 } | |
1265 } | |
1266 } | |
1267 | |
1268 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | |
1269 plot->SetSuggestedYAxis(0, 1, "Timestamp (90khz)", kBottomMargin, kTopMargin); | |
1270 plot->SetTitle("Timestamps"); | |
1271 } | |
1201 } // namespace plotting | 1272 } // namespace plotting |
1202 } // namespace webrtc | 1273 } // namespace webrtc |
OLD | NEW |