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

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

Issue 2892913002: Change how event_log_visualizer ignore duplicate incoming RTCP packets. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 // Maps a stream identifier consisting of ssrc and direction 302 // Maps a stream identifier consisting of ssrc and direction
303 // to the header extensions used by that stream, 303 // to the header extensions used by that stream,
304 std::map<StreamId, RtpHeaderExtensionMap> extension_maps; 304 std::map<StreamId, RtpHeaderExtensionMap> extension_maps;
305 305
306 PacketDirection direction; 306 PacketDirection direction;
307 uint8_t header[IP_PACKET_SIZE]; 307 uint8_t header[IP_PACKET_SIZE];
308 size_t header_length; 308 size_t header_length;
309 size_t total_length; 309 size_t total_length;
310 310
311 uint8_t last_incoming_rtcp_packet[IP_PACKET_SIZE];
312 memset(&last_incoming_rtcp_packet, 0, 1);
313
311 // Make a default extension map for streams without configuration information. 314 // Make a default extension map for streams without configuration information.
312 // TODO(ivoc): Once configuration of audio streams is stored in the event log, 315 // TODO(ivoc): Once configuration of audio streams is stored in the event log,
313 // this can be removed. Tracking bug: webrtc:6399 316 // this can be removed. Tracking bug: webrtc:6399
314 RtpHeaderExtensionMap default_extension_map = GetDefaultHeaderExtensionMap(); 317 RtpHeaderExtensionMap default_extension_map = GetDefaultHeaderExtensionMap();
315 318
316 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { 319 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) {
317 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i); 320 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i);
318 if (event_type != ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT && 321 if (event_type != ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT &&
319 event_type != ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT && 322 event_type != ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT &&
320 event_type != ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT && 323 event_type != ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT &&
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 uint64_t timestamp = parsed_log_.GetTimestamp(i); 399 uint64_t timestamp = parsed_log_.GetTimestamp(i);
397 rtp_packets_[stream].push_back( 400 rtp_packets_[stream].push_back(
398 LoggedRtpPacket(timestamp, parsed_header, total_length)); 401 LoggedRtpPacket(timestamp, parsed_header, total_length));
399 break; 402 break;
400 } 403 }
401 case ParsedRtcEventLog::RTCP_EVENT: { 404 case ParsedRtcEventLog::RTCP_EVENT: {
402 uint8_t packet[IP_PACKET_SIZE]; 405 uint8_t packet[IP_PACKET_SIZE];
403 MediaType media_type; 406 MediaType media_type;
404 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, 407 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet,
405 &total_length); 408 &total_length);
406 409 // Currently incoming RTCP packets are logged twice, both for audio and
407 // Currently feedback is logged twice, both for audio and video. 410 // video. Only act on one of them.
408 // Only act on one of them. 411 if (direction == webrtc::kIncomingPacket &&
409 if (media_type == MediaType::AUDIO || media_type == MediaType::ANY) { 412 memcmp(last_incoming_rtcp_packet, packet, IP_PACKET_SIZE) == 0) {
terelius 2017/05/19 12:07:32 This reads outside the actual packet. Maybe store
perkj_webrtc 2017/05/19 12:29:05 both are of size IP_PACKET_SIZE. Sure I can store
terelius 2017/05/19 12:47:02 The buffers are of size IP_PACKET_SIZE, but the ac
410 rtcp::CommonHeader header; 413 continue;
411 const uint8_t* packet_end = packet + total_length; 414 } else {
412 for (const uint8_t* block = packet; block < packet_end; 415 memcpy(last_incoming_rtcp_packet, packet, IP_PACKET_SIZE);
terelius 2017/05/19 12:07:32 Doesn't this copy outgoing RTCP into last_incoming
perkj_webrtc 2017/05/19 12:29:05 .... eh, good cath.... But it does not matter. I w
413 block = header.NextPacket()) { 416 }
414 RTC_CHECK(header.Parse(block, packet_end - block)); 417 rtcp::CommonHeader header;
415 if (header.type() == rtcp::TransportFeedback::kPacketType && 418 const uint8_t* packet_end = packet + total_length;
416 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) { 419 for (const uint8_t* block = packet; block < packet_end;
417 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet( 420 block = header.NextPacket()) {
418 new rtcp::TransportFeedback()); 421 RTC_CHECK(header.Parse(block, packet_end - block));
419 if (rtcp_packet->Parse(header)) { 422 if (header.type() == rtcp::TransportFeedback::kPacketType &&
420 uint32_t ssrc = rtcp_packet->sender_ssrc(); 423 header.fmt() == rtcp::TransportFeedback::kFeedbackMessageType) {
421 StreamId stream(ssrc, direction); 424 std::unique_ptr<rtcp::TransportFeedback> rtcp_packet(
422 uint64_t timestamp = parsed_log_.GetTimestamp(i); 425 new rtcp::TransportFeedback());
423 rtcp_packets_[stream].push_back(LoggedRtcpPacket( 426 if (rtcp_packet->Parse(header)) {
424 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet))); 427 uint32_t ssrc = rtcp_packet->sender_ssrc();
425 } 428 StreamId stream(ssrc, direction);
426 } else if (header.type() == rtcp::SenderReport::kPacketType) { 429 uint64_t timestamp = parsed_log_.GetTimestamp(i);
427 std::unique_ptr<rtcp::SenderReport> rtcp_packet( 430 rtcp_packets_[stream].push_back(LoggedRtcpPacket(
428 new rtcp::SenderReport()); 431 timestamp, kRtcpTransportFeedback, std::move(rtcp_packet)));
429 if (rtcp_packet->Parse(header)) { 432 }
430 uint32_t ssrc = rtcp_packet->sender_ssrc(); 433 } else if (header.type() == rtcp::SenderReport::kPacketType) {
431 StreamId stream(ssrc, direction); 434 std::unique_ptr<rtcp::SenderReport> rtcp_packet(
432 uint64_t timestamp = parsed_log_.GetTimestamp(i); 435 new rtcp::SenderReport());
433 rtcp_packets_[stream].push_back(LoggedRtcpPacket( 436 if (rtcp_packet->Parse(header)) {
434 timestamp, kRtcpSr, std::move(rtcp_packet))); 437 uint32_t ssrc = rtcp_packet->sender_ssrc();
435 } 438 StreamId stream(ssrc, direction);
436 } else if (header.type() == rtcp::ReceiverReport::kPacketType) { 439 uint64_t timestamp = parsed_log_.GetTimestamp(i);
437 std::unique_ptr<rtcp::ReceiverReport> rtcp_packet( 440 rtcp_packets_[stream].push_back(
438 new rtcp::ReceiverReport()); 441 LoggedRtcpPacket(timestamp, kRtcpSr, std::move(rtcp_packet)));
439 if (rtcp_packet->Parse(header)) { 442 }
440 uint32_t ssrc = rtcp_packet->sender_ssrc(); 443 } else if (header.type() == rtcp::ReceiverReport::kPacketType) {
441 StreamId stream(ssrc, direction); 444 std::unique_ptr<rtcp::ReceiverReport> rtcp_packet(
442 uint64_t timestamp = parsed_log_.GetTimestamp(i); 445 new rtcp::ReceiverReport());
443 rtcp_packets_[stream].push_back(LoggedRtcpPacket( 446 if (rtcp_packet->Parse(header)) {
444 timestamp, kRtcpRr, std::move(rtcp_packet))); 447 uint32_t ssrc = rtcp_packet->sender_ssrc();
445 } 448 StreamId stream(ssrc, direction);
449 uint64_t timestamp = parsed_log_.GetTimestamp(i);
450 rtcp_packets_[stream].push_back(
451 LoggedRtcpPacket(timestamp, kRtcpRr, std::move(rtcp_packet)));
446 } 452 }
447 } 453 }
448 } 454 }
449 break; 455 break;
450 } 456 }
451 case ParsedRtcEventLog::LOG_START: { 457 case ParsedRtcEventLog::LOG_START: {
452 break; 458 break;
453 } 459 }
454 case ParsedRtcEventLog::LOG_END: { 460 case ParsedRtcEventLog::LOG_END: {
455 break; 461 break;
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 }, 1394 },
1389 audio_network_adaptation_events_, begin_time_, &time_series); 1395 audio_network_adaptation_events_, begin_time_, &time_series);
1390 plot->AppendTimeSeries(std::move(time_series)); 1396 plot->AppendTimeSeries(std::move(time_series));
1391 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1397 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1392 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))", 1398 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))",
1393 kBottomMargin, kTopMargin); 1399 kBottomMargin, kTopMargin);
1394 plot->SetTitle("Reported audio encoder number of channels"); 1400 plot->SetTitle("Reported audio encoder number of channels");
1395 } 1401 }
1396 } // namespace plotting 1402 } // namespace plotting
1397 } // namespace webrtc 1403 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698