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

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

Issue 2378113002: Allow max 1 block per type in RTCP Extended Reports (Closed)
Patch Set: use operator==(T, Optional<T>) for slightly cleaner tests 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) 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 694
695 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime( 695 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime(
696 const RtcpContext& ctx) { 696 const RtcpContext& ctx) {
697 697
698 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports(); 698 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
699 xr->SetSenderSsrc(ssrc_); 699 xr->SetSenderSsrc(ssrc_);
700 700
701 rtcp::Rrtr rrtr; 701 rtcp::Rrtr rrtr;
702 rrtr.SetNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_)); 702 rrtr.SetNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
703 703
704 xr->AddRrtr(rrtr); 704 xr->SetRrtr(rrtr);
705 705
706 // TODO(sprang): Merge XR report sending to contain all of RRTR, DLRR, VOIP? 706 // TODO(sprang): Merge XR report sending to contain all of RRTR, DLRR, VOIP?
707 707
708 return std::unique_ptr<rtcp::RtcpPacket>(xr); 708 return std::unique_ptr<rtcp::RtcpPacket>(xr);
709 } 709 }
710 710
711 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr( 711 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr(
712 const RtcpContext& ctx) { 712 const RtcpContext& ctx) {
713 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports(); 713 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
714 xr->SetSenderSsrc(ssrc_); 714 xr->SetSenderSsrc(ssrc_);
715
716 rtcp::Dlrr dlrr;
717 RTC_DCHECK(ctx.feedback_state_.has_last_xr_rr); 715 RTC_DCHECK(ctx.feedback_state_.has_last_xr_rr);
718 dlrr.AddDlrrItem(ctx.feedback_state_.last_xr_rr); 716 xr->AddDlrrItem(ctx.feedback_state_.last_xr_rr);
719
720 xr->AddDlrr(dlrr);
721 717
722 return std::unique_ptr<rtcp::RtcpPacket>(xr); 718 return std::unique_ptr<rtcp::RtcpPacket>(xr);
723 } 719 }
724 720
725 // TODO(sprang): Add a unit test for this, or remove if the code isn't used.
726 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric( 721 std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric(
727 const RtcpContext& context) { 722 const RtcpContext& context) {
728 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports(); 723 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
729 xr->SetSenderSsrc(ssrc_); 724 xr->SetSenderSsrc(ssrc_);
730 725
731 rtcp::VoipMetric voip; 726 rtcp::VoipMetric voip;
732 voip.SetMediaSsrc(remote_ssrc_); 727 voip.SetMediaSsrc(remote_ssrc_);
733 voip.SetVoipMetric(xr_voip_metric_); 728 voip.SetVoipMetric(xr_voip_metric_);
734 729
735 xr->AddVoipMetric(voip); 730 xr->SetVoipMetric(voip);
736 731
737 return std::unique_ptr<rtcp::RtcpPacket>(xr); 732 return std::unique_ptr<rtcp::RtcpPacket>(xr);
738 } 733 }
739 734
740 int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state, 735 int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state,
741 RTCPPacketType packetType, 736 RTCPPacketType packetType,
742 int32_t nack_size, 737 int32_t nack_size,
743 const uint16_t* nack_list, 738 const uint16_t* nack_list,
744 bool repeat, 739 bool repeat,
745 uint64_t pictureID) { 740 uint64_t pictureID) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 // but we can't because of an incorrect warning (C4822) in MVS 2013. 1037 // but we can't because of an incorrect warning (C4822) in MVS 2013.
1043 } sender(transport_, event_log_); 1038 } sender(transport_, event_log_);
1044 1039
1045 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE)); 1040 RTC_DCHECK_LE(max_payload_length_, static_cast<size_t>(IP_PACKET_SIZE));
1046 uint8_t buffer[IP_PACKET_SIZE]; 1041 uint8_t buffer[IP_PACKET_SIZE];
1047 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) && 1042 return packet.BuildExternalBuffer(buffer, max_payload_length_, &sender) &&
1048 !sender.send_failure_; 1043 !sender.send_failure_;
1049 } 1044 }
1050 1045
1051 } // namespace webrtc 1046 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc ('k') | webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698