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

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

Issue 1579213005: [rtp_rtcp] rtcp::Xr moved into own file and renamed to ExtendedReports on the way (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
11 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
12 12
13 #include <assert.h> // assert 13 #include <assert.h> // assert
14 #include <string.h> // memcpy 14 #include <string.h> // memcpy
15 15
16 #include <algorithm> // min 16 #include <algorithm> // min
17 #include <limits> // max 17 #include <limits> // max
18 #include <utility> 18 #include <utility>
19 19
20 #include "webrtc/base/checks.h" 20 #include "webrtc/base/checks.h"
21 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
22 #include "webrtc/base/trace_event.h" 22 #include "webrtc/base/trace_event.h"
23 #include "webrtc/common_types.h" 23 #include "webrtc/common_types.h"
24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 24 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/nack.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sli.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h"
34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
35 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" 36 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
36 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 37 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
37 38
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 734 }
734 735
735 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime( 736 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime(
736 const RtcpContext& ctx) { 737 const RtcpContext& ctx) {
737 if (last_xr_rr_.size() >= RTCP_NUMBER_OF_SR) 738 if (last_xr_rr_.size() >= RTCP_NUMBER_OF_SR)
738 last_xr_rr_.erase(last_xr_rr_.begin()); 739 last_xr_rr_.erase(last_xr_rr_.begin());
739 last_xr_rr_.insert(std::pair<uint32_t, int64_t>( 740 last_xr_rr_.insert(std::pair<uint32_t, int64_t>(
740 RTCPUtility::MidNtp(ctx.ntp_sec_, ctx.ntp_frac_), 741 RTCPUtility::MidNtp(ctx.ntp_sec_, ctx.ntp_frac_),
741 Clock::NtpToMs(ctx.ntp_sec_, ctx.ntp_frac_))); 742 Clock::NtpToMs(ctx.ntp_sec_, ctx.ntp_frac_)));
742 743
743 rtcp::Xr* xr = new rtcp::Xr(); 744 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
744 xr->From(ssrc_); 745 xr->From(ssrc_);
745 746
746 rtcp::Rrtr rrtr; 747 rtcp::Rrtr rrtr;
747 rrtr.WithNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_)); 748 rrtr.WithNtp(NtpTime(ctx.ntp_sec_, ctx.ntp_frac_));
748 749
749 xr->WithRrtr(&rrtr); 750 xr->WithRrtr(&rrtr);
750 751
751 // TODO(sprang): Merge XR report sending to contain all of RRTR, DLRR, VOIP? 752 // TODO(sprang): Merge XR report sending to contain all of RRTR, DLRR, VOIP?
752 753
753 return rtc::scoped_ptr<rtcp::Xr>(xr); 754 return rtc::scoped_ptr<rtcp::RtcpPacket>(xr);
754 } 755 }
755 756
756 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr( 757 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr(
757 const RtcpContext& ctx) { 758 const RtcpContext& ctx) {
758 rtcp::Xr* xr = new rtcp::Xr(); 759 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
759 xr->From(ssrc_); 760 xr->From(ssrc_);
760 761
761 rtcp::Dlrr dlrr; 762 rtcp::Dlrr dlrr;
762 const RtcpReceiveTimeInfo& info = ctx.feedback_state_.last_xr_rr; 763 const RtcpReceiveTimeInfo& info = ctx.feedback_state_.last_xr_rr;
763 dlrr.WithDlrrItem(info.sourceSSRC, info.lastRR, info.delaySinceLastRR); 764 dlrr.WithDlrrItem(info.sourceSSRC, info.lastRR, info.delaySinceLastRR);
764 765
765 xr->WithDlrr(&dlrr); 766 xr->WithDlrr(&dlrr);
766 767
767 return rtc::scoped_ptr<rtcp::Xr>(xr); 768 return rtc::scoped_ptr<rtcp::RtcpPacket>(xr);
768 } 769 }
769 770
770 // TODO(sprang): Add a unit test for this, or remove if the code isn't used. 771 // TODO(sprang): Add a unit test for this, or remove if the code isn't used.
771 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric( 772 rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric(
772 const RtcpContext& context) { 773 const RtcpContext& context) {
773 rtcp::Xr* xr = new rtcp::Xr(); 774 rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
774 xr->From(ssrc_); 775 xr->From(ssrc_);
775 776
776 rtcp::VoipMetric voip; 777 rtcp::VoipMetric voip;
777 voip.To(remote_ssrc_); 778 voip.To(remote_ssrc_);
778 voip.WithVoipMetric(xr_voip_metric_); 779 voip.WithVoipMetric(xr_voip_metric_);
779 780
780 xr->WithVoipMetric(&voip); 781 xr->WithVoipMetric(&voip);
781 782
782 return rtc::scoped_ptr<rtcp::Xr>(xr); 783 return rtc::scoped_ptr<rtcp::RtcpPacket>(xr);
783 } 784 }
784 785
785 int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state, 786 int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state,
786 RTCPPacketType packetType, 787 RTCPPacketType packetType,
787 int32_t nack_size, 788 int32_t nack_size,
788 const uint16_t* nack_list, 789 const uint16_t* nack_list,
789 bool repeat, 790 bool repeat,
790 uint64_t pictureID) { 791 uint64_t pictureID) {
791 return SendCompoundRTCP( 792 return SendCompoundRTCP(
792 feedback_state, std::set<RTCPPacketType>(&packetType, &packetType + 1), 793 feedback_state, std::set<RTCPPacketType>(&packetType, &packetType + 1),
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 Transport* const transport_; 1054 Transport* const transport_;
1054 bool send_failure_; 1055 bool send_failure_;
1055 } sender(transport_); 1056 } sender(transport_);
1056 1057
1057 uint8_t buffer[IP_PACKET_SIZE]; 1058 uint8_t buffer[IP_PACKET_SIZE];
1058 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) && 1059 return packet.BuildExternalBuffer(buffer, IP_PACKET_SIZE, &sender) &&
1059 !sender.send_failure_; 1060 !sender.send_failure_;
1060 } 1061 }
1061 1062
1062 } // namespace webrtc 1063 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698