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

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

Issue 2395383002: Replace rtcp parser in rtc event log handlers. (Closed)
Patch Set: Created 4 years, 2 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/base/checks.h" 22 #include "webrtc/base/checks.h"
23 #include "webrtc/base/logging.h" 23 #include "webrtc/base/logging.h"
24 #include "webrtc/base/rate_statistics.h" 24 #include "webrtc/base/rate_statistics.h"
25 #include "webrtc/call.h" 25 #include "webrtc/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/rtp_utility.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
34 #include "webrtc/video_receive_stream.h" 34 #include "webrtc/video_receive_stream.h"
35 #include "webrtc/video_send_stream.h" 35 #include "webrtc/video_send_stream.h"
36 36
37 namespace webrtc { 37 namespace webrtc {
38 namespace plotting { 38 namespace plotting {
39 39
40 namespace { 40 namespace {
41 41
42 std::string SsrcToString(uint32_t ssrc) { 42 std::string SsrcToString(uint32_t ssrc) {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 rtp_packets_[stream].push_back( 385 rtp_packets_[stream].push_back(
386 LoggedRtpPacket(timestamp, parsed_header, total_length)); 386 LoggedRtpPacket(timestamp, parsed_header, total_length));
387 break; 387 break;
388 } 388 }
389 case ParsedRtcEventLog::RTCP_EVENT: { 389 case ParsedRtcEventLog::RTCP_EVENT: {
390 uint8_t packet[IP_PACKET_SIZE]; 390 uint8_t packet[IP_PACKET_SIZE];
391 MediaType media_type; 391 MediaType media_type;
392 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, 392 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet,
393 &total_length); 393 &total_length);
394 394
395 RtpUtility::RtpHeaderParser rtp_parser(packet, total_length); 395 // Currently feedback is logged twice, both for audio and video.
396 RTPHeader parsed_header; 396 // Only act on one of them.
397 RTC_CHECK(rtp_parser.ParseRtcp(&parsed_header)); 397 if (media_type == MediaType::VIDEO) {
398 uint32_t ssrc = parsed_header.ssrc; 398 rtcp::CommonHeader header;
399 399 const uint8_t* packet_end = packet + total_length;
400 RTCPUtility::RTCPParserV2 rtcp_parser(packet, total_length, true); 400 for (const uint8_t* block = packet; block < packet_end;
401 RTC_CHECK(rtcp_parser.IsValid()); 401 block = header.NextPacket()) {
402 402 RTC_CHECK(header.Parse(block, packet_end - block));
403 RTCPUtility::RTCPPacketTypes packet_type = rtcp_parser.Begin(); 403 if (header.type() == rtcp::TransportFeedback::kPacketType &&
404 while (packet_type != RTCPUtility::RTCPPacketTypes::kInvalid) { 404 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) {
405 switch (packet_type) { 405 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet(
406 case RTCPUtility::RTCPPacketTypes::kTransportFeedback: { 406 new rtcp::TransportFeedback());
407 // Currently feedback is logged twice, both for audio and video. 407 if (rtcp_packet->Parse(header)) {
408 // Only act on one of them. 408 uint32_t ssrc = rtcp_packet->sender_ssrc();
409 if (media_type == MediaType::VIDEO) {
410 std::unique_ptr<rtcp::RtcpPacket> rtcp_packet(
411 rtcp_parser.ReleaseRtcpPacket());
412 StreamId stream(ssrc, direction); 409 StreamId stream(ssrc, direction);
413 uint64_t timestamp = parsed_log_.GetTimestamp(i); 410 uint64_t timestamp = parsed_log_.GetTimestamp(i);
414 rtcp_packets_[stream].push_back(LoggedRtcpPacket( 411 rtcp_packets_[stream].push_back(LoggedRtcpPacket(
415 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet))); 412 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet)));
416 } 413 }
417 break;
418 } 414 }
419 default:
420 break;
421 } 415 }
422 rtcp_parser.Iterate();
423 packet_type = rtcp_parser.PacketType();
424 } 416 }
425 break; 417 break;
426 } 418 }
427 case ParsedRtcEventLog::LOG_START: { 419 case ParsedRtcEventLog::LOG_START: {
428 break; 420 break;
429 } 421 }
430 case ParsedRtcEventLog::LOG_END: { 422 case ParsedRtcEventLog::LOG_END: {
431 break; 423 break;
432 } 424 }
433 case ParsedRtcEventLog::BWE_PACKET_LOSS_EVENT: { 425 case ParsedRtcEventLog::BWE_PACKET_LOSS_EVENT: {
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 point.y -= estimated_base_delay_ms; 1159 point.y -= estimated_base_delay_ms;
1168 // Add the data set to the plot. 1160 // Add the data set to the plot.
1169 plot->series_list_.push_back(std::move(time_series)); 1161 plot->series_list_.push_back(std::move(time_series));
1170 1162
1171 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1163 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1172 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); 1164 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin);
1173 plot->SetTitle("Network Delay Change."); 1165 plot->SetTitle("Network Delay Change.");
1174 } 1166 }
1175 } // namespace plotting 1167 } // namespace plotting
1176 } // namespace webrtc 1168 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698