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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc

Issue 3006683002: Reland of Verify sender ssrc when receiving rtcp target bitrate (Closed)
Patch Set: Created 3 years, 3 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 ++num_skipped_packets_; 681 ++num_skipped_packets_;
682 return; 682 return;
683 } 683 }
684 684
685 if (xr.rrtr()) 685 if (xr.rrtr())
686 HandleXrReceiveReferenceTime(xr.sender_ssrc(), *xr.rrtr()); 686 HandleXrReceiveReferenceTime(xr.sender_ssrc(), *xr.rrtr());
687 687
688 for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks()) 688 for (const rtcp::ReceiveTimeInfo& time_info : xr.dlrr().sub_blocks())
689 HandleXrDlrrReportBlock(time_info); 689 HandleXrDlrrReportBlock(time_info);
690 690
691 if (xr.target_bitrate()) 691 if (xr.target_bitrate()) {
692 HandleXrTargetBitrate(*xr.target_bitrate(), packet_information); 692 HandleXrTargetBitrate(xr.sender_ssrc(), *xr.target_bitrate(),
693 packet_information);
694 }
693 } 695 }
694 696
695 void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc, 697 void RTCPReceiver::HandleXrReceiveReferenceTime(uint32_t sender_ssrc,
696 const rtcp::Rrtr& rrtr) { 698 const rtcp::Rrtr& rrtr) {
697 remote_time_info_.ssrc = sender_ssrc; 699 remote_time_info_.ssrc = sender_ssrc;
698 remote_time_info_.last_rr = CompactNtp(rrtr.ntp()); 700 remote_time_info_.last_rr = CompactNtp(rrtr.ntp());
699 last_received_xr_ntp_ = clock_->CurrentNtpTime(); 701 last_received_xr_ntp_ = clock_->CurrentNtpTime();
700 } 702 }
701 703
702 void RTCPReceiver::HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) { 704 void RTCPReceiver::HandleXrDlrrReportBlock(const rtcp::ReceiveTimeInfo& rti) {
(...skipping 12 matching lines...) Expand all
715 return; 717 return;
716 718
717 uint32_t delay_ntp = rti.delay_since_last_rr; 719 uint32_t delay_ntp = rti.delay_since_last_rr;
718 uint32_t now_ntp = CompactNtp(clock_->CurrentNtpTime()); 720 uint32_t now_ntp = CompactNtp(clock_->CurrentNtpTime());
719 721
720 uint32_t rtt_ntp = now_ntp - delay_ntp - send_time_ntp; 722 uint32_t rtt_ntp = now_ntp - delay_ntp - send_time_ntp;
721 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp); 723 xr_rr_rtt_ms_ = CompactNtpRttToMs(rtt_ntp);
722 } 724 }
723 725
724 void RTCPReceiver::HandleXrTargetBitrate( 726 void RTCPReceiver::HandleXrTargetBitrate(
727 uint32_t ssrc,
725 const rtcp::TargetBitrate& target_bitrate, 728 const rtcp::TargetBitrate& target_bitrate,
726 PacketInformation* packet_information) { 729 PacketInformation* packet_information) {
730 if (ssrc != remote_ssrc_) {
731 return; // Not for us.
732 }
733
727 BitrateAllocation bitrate_allocation; 734 BitrateAllocation bitrate_allocation;
728 for (const auto& item : target_bitrate.GetTargetBitrates()) { 735 for (const auto& item : target_bitrate.GetTargetBitrates()) {
729 if (item.spatial_layer >= kMaxSpatialLayers || 736 if (item.spatial_layer >= kMaxSpatialLayers ||
730 item.temporal_layer >= kMaxTemporalStreams) { 737 item.temporal_layer >= kMaxTemporalStreams) {
731 LOG(LS_WARNING) 738 LOG(LS_WARNING)
732 << "Invalid layer in XR target bitrate pack: spatial index " 739 << "Invalid layer in XR target bitrate pack: spatial index "
733 << item.spatial_layer << ", temporal index " << item.temporal_layer 740 << item.spatial_layer << ", temporal index " << item.temporal_layer
734 << ", dropping."; 741 << ", dropping.";
735 } else { 742 } else {
736 bitrate_allocation.SetBitrate(item.spatial_layer, item.temporal_layer, 743 bitrate_allocation.SetBitrate(item.spatial_layer, item.temporal_layer,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 } else { 1041 } else {
1035 candidates.push_back(it->second.tmmbr_item); 1042 candidates.push_back(it->second.tmmbr_item);
1036 ++it; 1043 ++it;
1037 } 1044 }
1038 } 1045 }
1039 } 1046 }
1040 return candidates; 1047 return candidates;
1041 } 1048 }
1042 1049
1043 } // namespace webrtc 1050 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698