| Index: webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
|
| diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
|
| index a3de360cf6a4a399eb82bbfa5353bf2e83061d2a..a5fccebad1dd67eb792fcf70ae402fafdcac5700 100644
|
| --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
|
| +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
|
| @@ -10,20 +10,14 @@
|
|
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
|
|
|
| -#include <assert.h> // assert
|
| #include <string.h> // memcpy
|
|
|
| -#include <algorithm> // min
|
| -#include <limits> // max
|
| -#include <utility>
|
| -
|
| #include "webrtc/base/checks.h"
|
| #include "webrtc/base/logging.h"
|
| #include "webrtc/base/trace_event.h"
|
| #include "webrtc/call.h"
|
| #include "webrtc/call/rtc_event_log.h"
|
| #include "webrtc/common_types.h"
|
| -#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/compound_packet.h"
|
| @@ -41,12 +35,9 @@
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
|
| #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
|
| -#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
|
|
| namespace webrtc {
|
|
|
| -using RTCPUtility::RTCPCnameInformation;
|
| -
|
| NACKStringBuilder::NACKStringBuilder()
|
| : stream_(""), count_(0), prevNack_(0), consecutive_(false) {}
|
|
|
| @@ -129,18 +120,14 @@ class RTCPSender::RtcpContext {
|
| bool repeat,
|
| uint64_t picture_id,
|
| uint32_t ntp_sec,
|
| - uint32_t ntp_frac,
|
| - PacketContainer* container)
|
| + uint32_t ntp_frac)
|
| : feedback_state_(feedback_state),
|
| nack_size_(nack_size),
|
| nack_list_(nack_list),
|
| repeat_(repeat),
|
| picture_id_(picture_id),
|
| ntp_sec_(ntp_sec),
|
| - ntp_frac_(ntp_frac),
|
| - container_(container) {}
|
| -
|
| - virtual ~RtcpContext() {}
|
| + ntp_frac_(ntp_frac) {}
|
|
|
| const FeedbackState& feedback_state_;
|
| const int32_t nack_size_;
|
| @@ -149,8 +136,6 @@ class RTCPSender::RtcpContext {
|
| const uint64_t picture_id_;
|
| const uint32_t ntp_sec_;
|
| const uint32_t ntp_frac_;
|
| -
|
| - PacketContainer* const container_;
|
| };
|
|
|
| RTCPSender::RTCPSender(
|
| @@ -166,9 +151,6 @@ RTCPSender::RTCPSender(
|
| method_(RtcpMode::kOff),
|
| event_log_(event_log),
|
| transport_(outgoing_transport),
|
| -
|
| - critical_section_rtcp_sender_(
|
| - CriticalSectionWrapper::CreateCriticalSection()),
|
| using_nack_(false),
|
| sending_(false),
|
| remb_enabled_(false),
|
| @@ -219,12 +201,12 @@ RTCPSender::RTCPSender(
|
| RTCPSender::~RTCPSender() {}
|
|
|
| RtcpMode RTCPSender::Status() const {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| return method_;
|
| }
|
|
|
| void RTCPSender::SetRTCPStatus(RtcpMode method) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| method_ = method;
|
|
|
| if (method == RtcpMode::kOff)
|
| @@ -235,7 +217,7 @@ void RTCPSender::SetRTCPStatus(RtcpMode method) {
|
| }
|
|
|
| bool RTCPSender::Sending() const {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| return sending_;
|
| }
|
|
|
| @@ -243,7 +225,7 @@ int32_t RTCPSender::SetSendingStatus(const FeedbackState& feedback_state,
|
| bool sending) {
|
| bool sendRTCPBye = false;
|
| {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
|
|
| if (method_ != RtcpMode::kOff) {
|
| if (sending == false && sending_ == true) {
|
| @@ -259,18 +241,18 @@ int32_t RTCPSender::SetSendingStatus(const FeedbackState& feedback_state,
|
| }
|
|
|
| bool RTCPSender::REMB() const {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| return remb_enabled_;
|
| }
|
|
|
| void RTCPSender::SetREMBStatus(bool enable) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| remb_enabled_ = enable;
|
| }
|
|
|
| void RTCPSender::SetREMBData(uint32_t bitrate,
|
| const std::vector<uint32_t>& ssrcs) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| remb_bitrate_ = bitrate;
|
| remb_ssrcs_ = ssrcs;
|
|
|
| @@ -282,12 +264,12 @@ void RTCPSender::SetREMBData(uint32_t bitrate,
|
| }
|
|
|
| bool RTCPSender::TMMBR() const {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| return IsFlagPresent(RTCPPacketType::kRtcpTmmbr);
|
| }
|
|
|
| void RTCPSender::SetTMMBRStatus(bool enable) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| if (enable) {
|
| SetFlag(RTCPPacketType::kRtcpTmmbr, false);
|
| } else {
|
| @@ -296,13 +278,13 @@ void RTCPSender::SetTMMBRStatus(bool enable) {
|
| }
|
|
|
| void RTCPSender::SetStartTimestamp(uint32_t start_timestamp) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| start_timestamp_ = start_timestamp;
|
| }
|
|
|
| void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp,
|
| int64_t capture_time_ms) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| last_rtp_timestamp_ = rtp_timestamp;
|
| if (capture_time_ms < 0) {
|
| // We don't currently get a capture time from VoiceEngine.
|
| @@ -313,7 +295,7 @@ void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp,
|
| }
|
|
|
| void RTCPSender::SetSSRC(uint32_t ssrc) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
|
|
| if (ssrc_ != 0) {
|
| // not first SetSSRC, probably due to a collision
|
| @@ -325,7 +307,7 @@ void RTCPSender::SetSSRC(uint32_t ssrc) {
|
| }
|
|
|
| void RTCPSender::SetRemoteSSRC(uint32_t ssrc) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| remote_ssrc_ = ssrc;
|
| }
|
|
|
| @@ -334,15 +316,15 @@ int32_t RTCPSender::SetCNAME(const char* c_name) {
|
| return -1;
|
|
|
| RTC_DCHECK_LT(strlen(c_name), static_cast<size_t>(RTCP_CNAME_SIZE));
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| cname_ = c_name;
|
| return 0;
|
| }
|
|
|
| int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) {
|
| - assert(c_name);
|
| + RTC_DCHECK(c_name);
|
| RTC_DCHECK_LT(strlen(c_name), static_cast<size_t>(RTCP_CNAME_SIZE));
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| if (csrc_cnames_.size() >= kRtpCsrcSize)
|
| return -1;
|
|
|
| @@ -351,7 +333,7 @@ int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char* c_name) {
|
| }
|
|
|
| int32_t RTCPSender::RemoveMixedCNAME(uint32_t SSRC) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| auto it = csrc_cnames_.find(SSRC);
|
|
|
| if (it == csrc_cnames_.end())
|
| @@ -422,7 +404,7 @@ bool RTCPSender::TimeToSendRTCPReport(bool sendKeyframeBeforeRTP) const {
|
|
|
| int64_t now = clock_->TimeInMilliseconds();
|
|
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
|
|
| if (method_ == RtcpMode::kOff)
|
| return false;
|
| @@ -443,7 +425,7 @@ bool RTCPSender::TimeToSendRTCPReport(bool sendKeyframeBeforeRTP) const {
|
| return false;
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSR(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSR(const RtcpContext& ctx) {
|
| // The timestamp of this RTCP packet should be estimated as the timestamp of
|
| // the frame being captured at this moment. We are calculating that
|
| // timestamp as the last frame's timestamp + the time since the last frame
|
| @@ -465,10 +447,10 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSR(const RtcpContext& ctx) {
|
|
|
| report_blocks_.clear();
|
|
|
| - return rtc::scoped_ptr<rtcp::SenderReport>(report);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(report);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSDES(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSDES(
|
| const RtcpContext& ctx) {
|
| size_t length_cname = cname_.length();
|
| RTC_CHECK_LT(length_cname, static_cast<size_t>(RTCP_CNAME_SIZE));
|
| @@ -479,20 +461,20 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSDES(
|
| for (const auto it : csrc_cnames_)
|
| sdes->WithCName(it.first, it.second);
|
|
|
| - return rtc::scoped_ptr<rtcp::Sdes>(sdes);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(sdes);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildRR(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildRR(const RtcpContext& ctx) {
|
| rtcp::ReceiverReport* report = new rtcp::ReceiverReport();
|
| report->From(ssrc_);
|
| for (auto it : report_blocks_)
|
| report->WithReportBlock(it.second);
|
|
|
| report_blocks_.clear();
|
| - return rtc::scoped_ptr<rtcp::ReceiverReport>(report);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(report);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildPLI(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildPLI(const RtcpContext& ctx) {
|
| rtcp::Pli* pli = new rtcp::Pli();
|
| pli->From(ssrc_);
|
| pli->To(remote_ssrc_);
|
| @@ -503,10 +485,10 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildPLI(const RtcpContext& ctx) {
|
| TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_PLICount",
|
| ssrc_, packet_type_counter_.pli_packets);
|
|
|
| - return rtc::scoped_ptr<rtcp::Pli>(pli);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(pli);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildFIR(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildFIR(const RtcpContext& ctx) {
|
| if (!ctx.repeat_)
|
| ++sequence_number_fir_; // Do not increase if repetition.
|
|
|
| @@ -520,7 +502,7 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildFIR(const RtcpContext& ctx) {
|
| TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_FIRCount",
|
| ssrc_, packet_type_counter_.fir_packets);
|
|
|
| - return rtc::scoped_ptr<rtcp::Fir>(fir);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(fir);
|
| }
|
|
|
| /*
|
| @@ -530,14 +512,14 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildFIR(const RtcpContext& ctx) {
|
| | First | Number | PictureID |
|
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
| */
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) {
|
| rtcp::Sli* sli = new rtcp::Sli();
|
| sli->From(ssrc_);
|
| sli->To(remote_ssrc_);
|
| // Crop picture id to 6 least significant bits.
|
| sli->WithPictureId(ctx.picture_id_ & 0x3F);
|
|
|
| - return rtc::scoped_ptr<rtcp::Sli>(sli);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(sli);
|
| }
|
|
|
| /*
|
| @@ -552,7 +534,7 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildSLI(const RtcpContext& ctx) {
|
| /*
|
| * Note: not generic made for VP8
|
| */
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildRPSI(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildRPSI(
|
| const RtcpContext& ctx) {
|
| if (ctx.feedback_state_.send_payload_type == 0xFF)
|
| return nullptr;
|
| @@ -563,10 +545,10 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildRPSI(
|
| rpsi->WithPayloadType(ctx.feedback_state_.send_payload_type);
|
| rpsi->WithPictureId(ctx.picture_id_);
|
|
|
| - return rtc::scoped_ptr<rtcp::Rpsi>(rpsi);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(rpsi);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB(
|
| const RtcpContext& ctx) {
|
| rtcp::Remb* remb = new rtcp::Remb();
|
| remb->From(ssrc_);
|
| @@ -577,15 +559,15 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildREMB(
|
| TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
|
| "RTCPSender::REMB");
|
|
|
| - return rtc::scoped_ptr<rtcp::Remb>(remb);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(remb);
|
| }
|
|
|
| void RTCPSender::SetTargetBitrate(unsigned int target_bitrate) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| tmmbr_send_ = target_bitrate / 1000;
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR(
|
| const RtcpContext& ctx) {
|
| if (ctx.feedback_state_.module == nullptr)
|
| return nullptr;
|
| @@ -643,10 +625,10 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBR(
|
| request.set_packet_overhead(packet_oh_send_);
|
| tmmbr->WithTmmbr(request);
|
|
|
| - return rtc::scoped_ptr<rtcp::Tmmbr>(tmmbr);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(tmmbr);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN(
|
| const RtcpContext& ctx) {
|
| TMMBRSet* boundingSet = tmmbr_help_.BoundingSetToSend();
|
| if (boundingSet == nullptr)
|
| @@ -661,20 +643,20 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildTMMBN(
|
| }
|
| }
|
|
|
| - return rtc::scoped_ptr<rtcp::Tmmbn>(tmmbn);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(tmmbn);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildAPP(const RtcpContext& ctx) {
|
| rtcp::App* app = new rtcp::App();
|
| app->From(ssrc_);
|
| app->WithSubType(app_sub_type_);
|
| app->WithName(app_name_);
|
| app->WithData(app_data_.get(), app_length_);
|
|
|
| - return rtc::scoped_ptr<rtcp::App>(app);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(app);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildNACK(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildNACK(
|
| const RtcpContext& ctx) {
|
| rtcp::Nack* nack = new rtcp::Nack();
|
| nack->From(ssrc_);
|
| @@ -697,19 +679,19 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildNACK(
|
| TRACE_COUNTER_ID1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), "RTCP_NACKCount",
|
| ssrc_, packet_type_counter_.nack_packets);
|
|
|
| - return rtc::scoped_ptr<rtcp::Nack>(nack);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(nack);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildBYE(const RtcpContext& ctx) {
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildBYE(const RtcpContext& ctx) {
|
| rtcp::Bye* bye = new rtcp::Bye();
|
| bye->From(ssrc_);
|
| for (uint32_t csrc : csrcs_)
|
| bye->WithCsrc(csrc);
|
|
|
| - return rtc::scoped_ptr<rtcp::Bye>(bye);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(bye);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime(
|
| const RtcpContext& ctx) {
|
|
|
| rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
|
| @@ -722,10 +704,10 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildReceiverReferenceTime(
|
|
|
| // TODO(sprang): Merge XR report sending to contain all of RRTR, DLRR, VOIP?
|
|
|
| - return rtc::scoped_ptr<rtcp::RtcpPacket>(xr);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(xr);
|
| }
|
|
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr(
|
| const RtcpContext& ctx) {
|
| rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
|
| xr->From(ssrc_);
|
| @@ -736,11 +718,11 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildDlrr(
|
|
|
| xr->WithDlrr(dlrr);
|
|
|
| - return rtc::scoped_ptr<rtcp::RtcpPacket>(xr);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(xr);
|
| }
|
|
|
| // TODO(sprang): Add a unit test for this, or remove if the code isn't used.
|
| -rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric(
|
| +std::unique_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric(
|
| const RtcpContext& context) {
|
| rtcp::ExtendedReports* xr = new rtcp::ExtendedReports();
|
| xr->From(ssrc_);
|
| @@ -751,7 +733,7 @@ rtc::scoped_ptr<rtcp::RtcpPacket> RTCPSender::BuildVoIPMetric(
|
|
|
| xr->WithVoipMetric(voip);
|
|
|
| - return rtc::scoped_ptr<rtcp::RtcpPacket>(xr);
|
| + return std::unique_ptr<rtcp::RtcpPacket>(xr);
|
| }
|
|
|
| int32_t RTCPSender::SendRTCP(const FeedbackState& feedback_state,
|
| @@ -774,7 +756,7 @@ int32_t RTCPSender::SendCompoundRTCP(
|
| uint64_t pictureID) {
|
| PacketContainer container(transport_, event_log_);
|
| {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| if (method_ == RtcpMode::kOff) {
|
| LOG(LS_WARNING) << "Can't send rtcp if it is disabled.";
|
| return -1;
|
| @@ -785,11 +767,11 @@ int32_t RTCPSender::SendCompoundRTCP(
|
| uint32_t ntp_frac;
|
| clock_->CurrentNtp(ntp_sec, ntp_frac);
|
| RtcpContext context(feedback_state, nack_size, nack_list, repeat, pictureID,
|
| - ntp_sec, ntp_frac, &container);
|
| + ntp_sec, ntp_frac);
|
|
|
| PrepareReport(packet_types, feedback_state);
|
|
|
| - rtc::scoped_ptr<rtcp::RtcpPacket> packet_bye;
|
| + std::unique_ptr<rtcp::RtcpPacket> packet_bye;
|
|
|
| auto it = report_flags_.begin();
|
| while (it != report_flags_.end()) {
|
| @@ -802,7 +784,7 @@ int32_t RTCPSender::SendCompoundRTCP(
|
| }
|
|
|
| BuilderFunc func = builder_it->second;
|
| - rtc::scoped_ptr<rtcp::RtcpPacket> packet = (this->*func)(context);
|
| + std::unique_ptr<rtcp::RtcpPacket> packet = (this->*func)(context);
|
| if (packet.get() == nullptr)
|
| return -1;
|
| // If there is a BYE, don't append now - save it and append it
|
| @@ -939,8 +921,8 @@ bool RTCPSender::AddReportBlock(const FeedbackState& feedback_state,
|
| }
|
|
|
| void RTCPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
|
| - assert(csrcs.size() <= kRtpCsrcSize);
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + RTC_DCHECK_LE(csrcs.size(), static_cast<size_t>(kRtpCsrcSize));
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| csrcs_ = csrcs;
|
| }
|
|
|
| @@ -952,7 +934,7 @@ int32_t RTCPSender::SetApplicationSpecificData(uint8_t subType,
|
| LOG(LS_ERROR) << "Failed to SetApplicationSpecificData.";
|
| return -1;
|
| }
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
|
|
| SetFlag(kRtcpApp, true);
|
| app_sub_type_ = subType;
|
| @@ -964,7 +946,7 @@ int32_t RTCPSender::SetApplicationSpecificData(uint8_t subType,
|
| }
|
|
|
| int32_t RTCPSender::SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| memcpy(&xr_voip_metric_, VoIPMetric, sizeof(RTCPVoIPMetric));
|
|
|
| SetFlag(kRtcpXrVoipMetric, true);
|
| @@ -972,18 +954,18 @@ int32_t RTCPSender::SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) {
|
| }
|
|
|
| void RTCPSender::SendRtcpXrReceiverReferenceTime(bool enable) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| xr_send_receiver_reference_time_enabled_ = enable;
|
| }
|
|
|
| bool RTCPSender::RtcpXrReceiverReferenceTime() const {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
| return xr_send_receiver_reference_time_enabled_;
|
| }
|
|
|
| // no callbacks allowed inside this function
|
| int32_t RTCPSender::SetTMMBN(const TMMBRSet* boundingSet) {
|
| - CriticalSectionScoped lock(critical_section_rtcp_sender_.get());
|
| + rtc::CritScope lock(&critical_section_rtcp_sender_);
|
|
|
| if (0 == tmmbr_help_.SetTMMBRBoundingSetToSend(boundingSet)) {
|
| SetFlag(kRtcpTmmbn, true);
|
|
|