diff --git a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h index e284977d2f..6b9a5542e1 100644 --- a/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h @@ -85,7 +85,7 @@ class RtpRtcp : public Module { virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet, size_t incoming_packet_length) = 0; - virtual void SetRemoteSSRC(const uint32_t ssrc) = 0; + virtual void SetRemoteSSRC(uint32_t ssrc) = 0; /************************************************************************** * @@ -100,7 +100,7 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetMaxTransferUnit(const uint16_t size) = 0; + virtual int32_t SetMaxTransferUnit(uint16_t size) = 0; /* * set transtport overhead @@ -114,9 +114,9 @@ class RtpRtcp : public Module { * return -1 on failure else 0 */ virtual int32_t SetTransportOverhead( - const bool TCP, - const bool IPV6, - const uint8_t authenticationOverhead = 0) = 0; + bool TCP, + bool IPV6, + uint8_t authenticationOverhead = 0) = 0; /* * Get max payload length @@ -161,20 +161,17 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t DeRegisterSendPayload( - const int8_t payloadType) = 0; + virtual int32_t DeRegisterSendPayload(int8_t payloadType) = 0; /* * (De)register RTP header extension type and id. * * return -1 on failure else 0 */ - virtual int32_t RegisterSendRtpHeaderExtension( - const RTPExtensionType type, - const uint8_t id) = 0; + virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type, + uint8_t id) = 0; - virtual int32_t DeregisterSendRtpHeaderExtension( - const RTPExtensionType type) = 0; + virtual int32_t DeregisterSendRtpHeaderExtension(RTPExtensionType type) = 0; /* * get start timestamp @@ -185,11 +182,8 @@ class RtpRtcp : public Module { * configure start timestamp, default is a random number * * timestamp - start timestamp - * - * return -1 on failure else 0 */ - virtual int32_t SetStartTimestamp( - const uint32_t timestamp) = 0; + virtual void SetStartTimestamp(uint32_t timestamp) = 0; /* * Get SequenceNumber @@ -198,10 +192,8 @@ class RtpRtcp : public Module { /* * Set SequenceNumber, default is a random number - * - * return -1 on failure else 0 */ - virtual int32_t SetSequenceNumber(const uint16_t seq) = 0; + virtual void SetSequenceNumber(uint16_t seq) = 0; virtual void SetRtpStateForSsrc(uint32_t ssrc, const RtpState& rtp_state) = 0; @@ -214,10 +206,8 @@ class RtpRtcp : public Module { /* * configure SSRC, default is a random number - * - * return -1 on failure else 0 */ - virtual void SetSSRC(const uint32_t ssrc) = 0; + virtual void SetSSRC(uint32_t ssrc) = 0; /* * Set CSRC @@ -253,7 +243,7 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetSendingStatus(const bool sending) = 0; + virtual int32_t SetSendingStatus(bool sending) = 0; /* * get send status @@ -264,10 +254,8 @@ class RtpRtcp : public Module { * Starts/Stops media packets, on by default * * sending - on/off - * - * return -1 on failure else 0 */ - virtual int32_t SetSendingMediaStatus(const bool sending) = 0; + virtual void SetSendingMediaStatus(bool sending) = 0; /* * get send status @@ -297,12 +285,12 @@ class RtpRtcp : public Module { * return -1 on failure else 0 */ virtual int32_t SendOutgoingData( - const FrameType frameType, - const int8_t payloadType, - const uint32_t timeStamp, + FrameType frameType, + int8_t payloadType, + uint32_t timeStamp, int64_t capture_time_ms, const uint8_t* payloadData, - const size_t payloadSize, + size_t payloadSize, const RTPFragmentationHeader* fragmentation = NULL, const RTPVideoHeader* rtpVideoHdr = NULL) = 0; @@ -337,10 +325,8 @@ class RtpRtcp : public Module { * configure RTCP status i.e on(compound or non- compound)/off * * method - RTCP method to use - * - * return -1 on failure else 0 */ - virtual int32_t SetRTCPStatus(const RTCPMethod method) = 0; + virtual void SetRTCPStatus(RTCPMethod method) = 0; /* * Set RTCP CName (i.e unique identifier) @@ -354,9 +340,8 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t RemoteCNAME( - const uint32_t remoteSSRC, - char cName[RTCP_CNAME_SIZE]) const = 0; + virtual int32_t RemoteCNAME(uint32_t remoteSSRC, + char cName[RTCP_CNAME_SIZE]) const = 0; /* * Get remote NTP @@ -375,27 +360,26 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t AddMixedCNAME( - const uint32_t SSRC, - const char cName[RTCP_CNAME_SIZE]) = 0; + virtual int32_t AddMixedCNAME(uint32_t SSRC, + const char cName[RTCP_CNAME_SIZE]) = 0; /* * RemoveMixedCNAME * * return -1 on failure else 0 */ - virtual int32_t RemoveMixedCNAME(const uint32_t SSRC) = 0; + virtual int32_t RemoveMixedCNAME(uint32_t SSRC) = 0; /* * Get RoundTripTime * * return -1 on failure else 0 */ - virtual int32_t RTT(const uint32_t remoteSSRC, + virtual int32_t RTT(uint32_t remoteSSRC, uint16_t* RTT, uint16_t* avgRTT, uint16_t* minRTT, - uint16_t* maxRTT) const = 0 ; + uint16_t* maxRTT) const = 0; /* * Force a send of a RTCP packet @@ -416,8 +400,7 @@ class RtpRtcp : public Module { * Send a RTCP Slice Loss Indication (SLI) * 6 least significant bits of pictureID */ - virtual int32_t SendRTCPSliceLossIndication( - const uint8_t pictureID) = 0; + virtual int32_t SendRTCPSliceLossIndication(uint8_t pictureID) = 0; /* * Reset RTP data counters for the sending side @@ -462,16 +445,15 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t AddRTCPReportBlock( - const uint32_t SSRC, - const RTCPReportBlock* receiveBlock) = 0; + virtual int32_t AddRTCPReportBlock(uint32_t SSRC, + const RTCPReportBlock* receiveBlock) = 0; /* * RemoveRTCPReportBlock * * return -1 on failure else 0 */ - virtual int32_t RemoveRTCPReportBlock(const uint32_t SSRC) = 0; + virtual int32_t RemoveRTCPReportBlock(uint32_t SSRC) = 0; /* * Get number of sent and received RTCP packet types. @@ -485,11 +467,10 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetRTCPApplicationSpecificData( - const uint8_t subType, - const uint32_t name, - const uint8_t* data, - const uint16_t length) = 0; + virtual int32_t SetRTCPApplicationSpecificData(uint8_t subType, + uint32_t name, + const uint8_t* data, + uint16_t length) = 0; /* * (XR) VOIP metric * @@ -510,28 +491,24 @@ class RtpRtcp : public Module { */ virtual bool REMB() const = 0; - virtual int32_t SetREMBStatus(const bool enable) = 0; + virtual void SetREMBStatus(bool enable) = 0; - virtual int32_t SetREMBData(const uint32_t bitrate, - const std::vector& ssrcs) = 0; + virtual void SetREMBData(uint32_t bitrate, + const std::vector& ssrcs) = 0; /* * (IJ) Extended jitter report. */ virtual bool IJ() const = 0; - virtual int32_t SetIJStatus(const bool enable) = 0; + virtual void SetIJStatus(bool enable) = 0; /* * (TMMBR) Temporary Max Media Bit Rate */ virtual bool TMMBR() const = 0; - /* - * - * return -1 on failure else 0 - */ - virtual int32_t SetTMMBRStatus(const bool enable) = 0; + virtual void SetTMMBRStatus(bool enable) = 0; /* * (NACK) @@ -562,18 +539,13 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SendNACK(const uint16_t* nackList, - const uint16_t size) = 0; + virtual int32_t SendNACK(const uint16_t* nackList, uint16_t size) = 0; /* * Store the sent packets, needed to answer to a Negative acknowledgement * requests - * - * return -1 on failure else 0 */ - virtual int32_t SetStorePacketsStatus( - const bool enable, - const uint16_t numberToStore) = 0; + virtual void SetStorePacketsStatus(bool enable, uint16_t numberToStore) = 0; // Returns true if the module is configured to store packets. virtual bool StorePackets() const = 0; @@ -596,8 +568,7 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetAudioPacketSize( - const uint16_t packetSizeSamples) = 0; + virtual int32_t SetAudioPacketSize(uint16_t packetSizeSamples) = 0; /* * SendTelephoneEventActive @@ -614,18 +585,16 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SendTelephoneEventOutband( - const uint8_t key, - const uint16_t time_ms, - const uint8_t level) = 0; + virtual int32_t SendTelephoneEventOutband(uint8_t key, + uint16_t time_ms, + uint8_t level) = 0; /* * Set payload type for Redundant Audio Data RFC 2198 * * return -1 on failure else 0 */ - virtual int32_t SetSendREDPayloadType( - const int8_t payloadType) = 0; + virtual int32_t SetSendREDPayloadType(int8_t payloadType) = 0; /* * Get payload type for Redundant Audio Data RFC 2198 @@ -643,7 +612,7 @@ class RtpRtcp : public Module { * * return -1 on failure else 0. */ - virtual int32_t SetAudioLevel(const uint8_t level_dBov) = 0; + virtual int32_t SetAudioLevel(uint8_t level_dBov) = 0; /************************************************************************** * @@ -656,7 +625,7 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetCameraDelay(const int32_t delayMS) = 0; + virtual int32_t SetCameraDelay(int32_t delayMS) = 0; /* * Set the target send bitrate @@ -669,10 +638,9 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetGenericFECStatus( - const bool enable, - const uint8_t payloadTypeRED, - const uint8_t payloadTypeFEC) = 0; + virtual int32_t SetGenericFECStatus(bool enable, + uint8_t payloadTypeRED, + uint8_t payloadTypeFEC) = 0; /* * Get generic FEC setting @@ -693,8 +661,7 @@ class RtpRtcp : public Module { * * return -1 on failure else 0 */ - virtual int32_t SetKeyFrameRequestMethod( - const KeyFrameRequestMethod method) = 0; + virtual int32_t SetKeyFrameRequestMethod(KeyFrameRequestMethod method) = 0; /* * send a request for a keyframe diff --git a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h index 079f677e90..31fade4791 100644 --- a/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h +++ b/webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h @@ -79,12 +79,10 @@ class MockRtpRtcp : public RtpRtcp { int32_t(const RTPExtensionType type)); MOCK_CONST_METHOD0(StartTimestamp, uint32_t()); - MOCK_METHOD1(SetStartTimestamp, - int32_t(const uint32_t timestamp)); + MOCK_METHOD1(SetStartTimestamp, void(const uint32_t timestamp)); MOCK_CONST_METHOD0(SequenceNumber, uint16_t()); - MOCK_METHOD1(SetSequenceNumber, - int32_t(const uint16_t seq)); + MOCK_METHOD1(SetSequenceNumber, void(const uint16_t seq)); MOCK_METHOD2(SetRtpStateForSsrc, void(uint32_t ssrc, const RtpState& rtp_state)); MOCK_METHOD2(GetRtpStateForSsrc, bool(uint32_t ssrc, RtpState* rtp_state)); @@ -109,8 +107,7 @@ class MockRtpRtcp : public RtpRtcp { int32_t(const bool sending)); MOCK_CONST_METHOD0(Sending, bool()); - MOCK_METHOD1(SetSendingMediaStatus, - int32_t(const bool sending)); + MOCK_METHOD1(SetSendingMediaStatus, void(const bool sending)); MOCK_CONST_METHOD0(SendingMedia, bool()); MOCK_CONST_METHOD4(BitrateSent, @@ -140,8 +137,7 @@ class MockRtpRtcp : public RtpRtcp { RtcpBandwidthObserver* bandwidthCallback)); MOCK_CONST_METHOD0(RTCP, RTCPMethod()); - MOCK_METHOD1(SetRTCPStatus, - int32_t(const RTCPMethod method)); + MOCK_METHOD1(SetRTCPStatus, void(const RTCPMethod method)); MOCK_METHOD1(SetCNAME, int32_t(const char cName[RTCP_CNAME_SIZE])); MOCK_CONST_METHOD2(RemoteCNAME, @@ -192,18 +188,16 @@ class MockRtpRtcp : public RtpRtcp { bool()); MOCK_CONST_METHOD0(REMB, bool()); - MOCK_METHOD1(SetREMBStatus, - int32_t(const bool enable)); + MOCK_METHOD1(SetREMBStatus, void(const bool enable)); MOCK_METHOD2(SetREMBData, - int32_t(const uint32_t bitrate, const std::vector& ssrcs)); + void(const uint32_t bitrate, + const std::vector& ssrcs)); MOCK_CONST_METHOD0(IJ, bool()); - MOCK_METHOD1(SetIJStatus, - int32_t(const bool)); + MOCK_METHOD1(SetIJStatus, void(const bool)); MOCK_CONST_METHOD0(TMMBR, bool()); - MOCK_METHOD1(SetTMMBRStatus, - int32_t(const bool enable)); + MOCK_METHOD1(SetTMMBRStatus, void(const bool enable)); MOCK_METHOD1(OnBandwidthEstimateUpdate, void(uint16_t bandWidthKbit)); MOCK_CONST_METHOD0(NACK, @@ -217,7 +211,7 @@ class MockRtpRtcp : public RtpRtcp { MOCK_METHOD2(SendNACK, int32_t(const uint16_t* nackList, const uint16_t size)); MOCK_METHOD2(SetStorePacketsStatus, - int32_t(const bool enable, const uint16_t numberToStore)); + void(const bool enable, const uint16_t numberToStore)); MOCK_CONST_METHOD0(StorePackets, bool()); MOCK_METHOD1(RegisterRtcpStatisticsCallback, void(RtcpStatisticsCallback*)); MOCK_METHOD0(GetRtcpStatisticsCallback, RtcpStatisticsCallback*()); diff --git a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc index d6e557d67b..bfe0af0766 100644 --- a/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc @@ -194,12 +194,12 @@ class RtpRtcpRtxNackTest : public ::testing::Test { &rtp_payload_registry_)); rtp_rtcp_module_->SetSSRC(kTestSsrc); - EXPECT_EQ(0, rtp_rtcp_module_->SetRTCPStatus(kRtcpCompound)); + rtp_rtcp_module_->SetRTCPStatus(kRtcpCompound); rtp_receiver_->SetNACKStatus(kNackRtcp); - EXPECT_EQ(0, rtp_rtcp_module_->SetStorePacketsStatus(true, 600)); + rtp_rtcp_module_->SetStorePacketsStatus(true, 600); EXPECT_EQ(0, rtp_rtcp_module_->SetSendingStatus(true)); - EXPECT_EQ(0, rtp_rtcp_module_->SetSequenceNumber(kTestSequenceNumber)); - EXPECT_EQ(0, rtp_rtcp_module_->SetStartTimestamp(111111)); + rtp_rtcp_module_->SetSequenceNumber(kTestSequenceNumber); + rtp_rtcp_module_->SetStartTimestamp(111111); transport_.SetSendModule(rtp_rtcp_module_, &rtp_payload_registry_, rtp_receiver_.get()); @@ -304,9 +304,9 @@ TEST_F(RtpRtcpRtxNackTest, LongNackList) { uint32_t timestamp = 3000; uint16_t nack_list[kNumPacketsToDrop]; // Disable StorePackets to be able to set a larger packet history. - EXPECT_EQ(0, rtp_rtcp_module_->SetStorePacketsStatus(false, 0)); + rtp_rtcp_module_->SetStorePacketsStatus(false, 0); // Enable StorePackets with a packet history of 2000 packets. - EXPECT_EQ(0, rtp_rtcp_module_->SetStorePacketsStatus(true, 2000)); + rtp_rtcp_module_->SetStorePacketsStatus(true, 2000); // Drop 900 packets from the second one so that we get a NACK list which is // big enough to require 4 RTCP packets to be fully transmitted to the sender. transport_.DropConsecutivePackets(2, kNumPacketsToDrop); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc index 6a7b7f9718..51fda7c247 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc @@ -109,20 +109,18 @@ void RtcpFormatRembTest::TearDown() { delete test_transport_; } -TEST_F(RtcpFormatRembTest, TestBasicAPI) { +TEST_F(RtcpFormatRembTest, TestRembStatus) { EXPECT_FALSE(rtcp_sender_->REMB()); - EXPECT_EQ(0, rtcp_sender_->SetREMBStatus(true)); + rtcp_sender_->SetREMBStatus(true); EXPECT_TRUE(rtcp_sender_->REMB()); - EXPECT_EQ(0, rtcp_sender_->SetREMBStatus(false)); + rtcp_sender_->SetREMBStatus(false); EXPECT_FALSE(rtcp_sender_->REMB()); - - EXPECT_EQ(0, rtcp_sender_->SetREMBData(1234, std::vector())); } TEST_F(RtcpFormatRembTest, TestNonCompund) { uint32_t SSRC = 456789; - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpNonCompound)); - EXPECT_EQ(0, rtcp_sender_->SetREMBData(1234, std::vector(1, SSRC))); + rtcp_sender_->SetRTCPStatus(kRtcpNonCompound); + rtcp_sender_->SetREMBData(1234, std::vector(1, SSRC)); RTCPSender::FeedbackState feedback_state = dummy_rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); @@ -130,9 +128,8 @@ TEST_F(RtcpFormatRembTest, TestNonCompund) { TEST_F(RtcpFormatRembTest, TestCompund) { uint32_t SSRCs[2] = {456789, 98765}; - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); - EXPECT_EQ(0, rtcp_sender_->SetREMBData( - 1234, std::vector(SSRCs, SSRCs + 2))); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); + rtcp_sender_->SetREMBData(1234, std::vector(SSRCs, SSRCs + 2)); RTCPSender::FeedbackState feedback_state = dummy_rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc index 8e5ac12372..3978332c22 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc @@ -28,33 +28,32 @@ using namespace RTCPHelp; // The number of RTCP time intervals needed to trigger a timeout. const int kRrTimeoutIntervals = 3; -RTCPReceiver::RTCPReceiver(const int32_t id, Clock* clock, - ModuleRtpRtcpImpl* owner) +RTCPReceiver::RTCPReceiver(int32_t id, Clock* clock, ModuleRtpRtcpImpl* owner) : TMMBRHelp(), - _id(id), - _clock(clock), - _method(kRtcpOff), - _lastReceived(0), - _rtpRtcp(*owner), + _id(id), + _clock(clock), + _method(kRtcpOff), + _lastReceived(0), + _rtpRtcp(*owner), _criticalSectionFeedbacks( CriticalSectionWrapper::CreateCriticalSection()), - _cbRtcpBandwidthObserver(NULL), - _cbRtcpIntraFrameObserver(NULL), - _criticalSectionRTCPReceiver( - CriticalSectionWrapper::CreateCriticalSection()), - main_ssrc_(0), - _remoteSSRC(0), - _remoteSenderInfo(), - _lastReceivedSRNTPsecs(0), - _lastReceivedSRNTPfrac(0), - _lastReceivedXRNTPsecs(0), - _lastReceivedXRNTPfrac(0), - xr_rr_rtt_ms_(0), - _receivedInfoMap(), - _packetTimeOutMS(0), - _lastReceivedRrMs(0), - _lastIncreasedSequenceNumberMs(0), - stats_callback_(NULL) { + _cbRtcpBandwidthObserver(NULL), + _cbRtcpIntraFrameObserver(NULL), + _criticalSectionRTCPReceiver( + CriticalSectionWrapper::CreateCriticalSection()), + main_ssrc_(0), + _remoteSSRC(0), + _remoteSenderInfo(), + _lastReceivedSRNTPsecs(0), + _lastReceivedSRNTPfrac(0), + _lastReceivedXRNTPsecs(0), + _lastReceivedXRNTPfrac(0), + xr_rr_rtt_ms_(0), + _receivedInfoMap(), + _packetTimeOutMS(0), + _lastReceivedRrMs(0), + _lastIncreasedSequenceNumberMs(0), + stats_callback_(NULL) { memset(&_remoteSenderInfo, 0, sizeof(_remoteSenderInfo)); } @@ -85,9 +84,7 @@ RTCPReceiver::~RTCPReceiver() { } } -void -RTCPReceiver::ChangeUniqueId(const int32_t id) -{ +void RTCPReceiver::ChangeUniqueId(int32_t id) { _id = id; } @@ -98,12 +95,9 @@ RTCPReceiver::Status() const return _method; } -int32_t -RTCPReceiver::SetRTCPStatus(const RTCPMethod method) -{ - CriticalSectionScoped lock(_criticalSectionRTCPReceiver); - _method = method; - return 0; +void RTCPReceiver::SetRTCPStatus(RTCPMethod method) { + CriticalSectionScoped lock(_criticalSectionRTCPReceiver); + _method = method; } int64_t @@ -126,9 +120,7 @@ RTCPReceiver::LastReceivedReceiverReport() const { return last_received_rr; } -int32_t -RTCPReceiver::SetRemoteSSRC( const uint32_t ssrc) -{ +int32_t RTCPReceiver::SetRemoteSSRC(uint32_t ssrc) { CriticalSectionScoped lock(_criticalSectionRTCPReceiver); // new SSRC reset old reports @@ -466,8 +458,8 @@ RTCPReceiver::HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, void RTCPReceiver::HandleReportBlock( const RTCPUtility::RTCPPacket& rtcpPacket, RTCPPacketInformation& rtcpPacketInformation, - const uint32_t remoteSSRC, - const uint8_t numberOfReportBlocks) + uint32_t remoteSSRC, + uint8_t numberOfReportBlocks) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPReceiver) { // This will be called once per report block in the RTCP packet. // We filter out all report blocks that are not for us. @@ -1079,12 +1071,10 @@ RTCPReceiver::HandleTMMBR(RTCPUtility::RTCPParserV2& rtcpParser, } // no need for critsect we have _criticalSectionRTCPReceiver -void -RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo, - const RTCPUtility::RTCPPacket& rtcpPacket, - RTCPPacketInformation& rtcpPacketInformation, - const uint32_t senderSSRC) -{ +void RTCPReceiver::HandleTMMBRItem(RTCPReceiveInformation& receiveInfo, + const RTCPUtility::RTCPPacket& rtcpPacket, + RTCPPacketInformation& rtcpPacketInformation, + uint32_t senderSSRC) { if (main_ssrc_ == rtcpPacket.TMMBRItem.SSRC && rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0) { @@ -1464,7 +1454,7 @@ void RTCPReceiver::TriggerCallbacksFromRTCPPacket( } } -int32_t RTCPReceiver::CNAME(const uint32_t remoteSSRC, +int32_t RTCPReceiver::CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const { assert(cName); @@ -1479,8 +1469,8 @@ int32_t RTCPReceiver::CNAME(const uint32_t remoteSSRC, } // no callbacks allowed inside this function -int32_t RTCPReceiver::TMMBRReceived(const uint32_t size, - const uint32_t accNumCandidates, +int32_t RTCPReceiver::TMMBRReceived(uint32_t size, + uint32_t accNumCandidates, TMMBRSet* candidateSet) const { CriticalSectionScoped lock(_criticalSectionRTCPReceiver); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h index b8fcb41e94..223da7692f 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h @@ -29,22 +29,21 @@ class ModuleRtpRtcpImpl; class RTCPReceiver : public TMMBRHelp { public: - RTCPReceiver(const int32_t id, Clock* clock, - ModuleRtpRtcpImpl* owner); + RTCPReceiver(int32_t id, Clock* clock, ModuleRtpRtcpImpl* owner); virtual ~RTCPReceiver(); - void ChangeUniqueId(const int32_t id); + void ChangeUniqueId(int32_t id); RTCPMethod Status() const; - int32_t SetRTCPStatus(const RTCPMethod method); + void SetRTCPStatus(RTCPMethod method); int64_t LastReceived(); int64_t LastReceivedReceiverReport() const; void SetSsrcs(uint32_t main_ssrc, const std::set& registered_ssrcs); - void SetRelaySSRC( const uint32_t ssrc); - int32_t SetRemoteSSRC( const uint32_t ssrc); + void SetRelaySSRC(uint32_t ssrc); + int32_t SetRemoteSSRC(uint32_t ssrc); uint32_t RemoteSSRC() const; uint32_t RelaySSRC() const; @@ -59,8 +58,7 @@ public: void TriggerCallbacksFromRTCPPacket(RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); // get received cname - int32_t CNAME(const uint32_t remoteSSRC, - char cName[RTCP_CNAME_SIZE]) const; + int32_t CNAME(uint32_t remoteSSRC, char cName[RTCP_CNAME_SIZE]) const; // get received NTP bool NTP(uint32_t* ReceivedNTPsecs, @@ -99,8 +97,8 @@ public: bool RtcpRrSequenceNumberTimeout(int64_t rtcp_interval_ms); // Get TMMBR - int32_t TMMBRReceived(const uint32_t size, - const uint32_t accNumCandidates, + int32_t TMMBRReceived(uint32_t size, + uint32_t accNumCandidates, TMMBRSet* candidateSet) const; bool UpdateRTCPReceiveInformationTimers(); @@ -113,21 +111,24 @@ public: RtcpStatisticsCallback* GetRtcpStatisticsCallback(); protected: - RTCPUtility::RTCPCnameInformation* CreateCnameInformation(const uint32_t remoteSSRC); - RTCPUtility::RTCPCnameInformation* GetCnameInformation(const uint32_t remoteSSRC) const; + RTCPUtility::RTCPCnameInformation* CreateCnameInformation(uint32_t remoteSSRC); + RTCPUtility::RTCPCnameInformation* GetCnameInformation( + uint32_t remoteSSRC) const; - RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation(const uint32_t remoteSSRC); - RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(const uint32_t remoteSSRC); + RTCPHelp::RTCPReceiveInformation* CreateReceiveInformation( + uint32_t remoteSSRC); + RTCPHelp::RTCPReceiveInformation* GetReceiveInformation(uint32_t remoteSSRC); void UpdateReceiveInformation( RTCPHelp::RTCPReceiveInformation& receiveInformation); void HandleSenderReceiverReport(RTCPUtility::RTCPParserV2& rtcpParser, RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); - void HandleReportBlock(const RTCPUtility::RTCPPacket& rtcpPacket, - RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, - const uint32_t remoteSSRC, - const uint8_t numberOfReportBlocks); + void HandleReportBlock( + const RTCPUtility::RTCPPacket& rtcpPacket, + RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, + uint32_t remoteSSRC, + uint8_t numberOfReportBlocks); void HandleSDES(RTCPUtility::RTCPParserV2& rtcpParser); @@ -189,7 +190,7 @@ protected: void HandleTMMBRItem(RTCPHelp::RTCPReceiveInformation& receiveInfo, const RTCPUtility::RTCPPacket& rtcpPacket, RTCPHelp::RTCPPacketInformation& rtcpPacketInformation, - const uint32_t senderSSRC); + uint32_t senderSSRC); void HandleTMMBN(RTCPUtility::RTCPParserV2& rtcpParser, RTCPHelp::RTCPPacketInformation& rtcpPacketInformation); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc index e060c8c9f4..c896d14ec6 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc @@ -76,62 +76,63 @@ RTCPSender::FeedbackState::FeedbackState() remote_sr(0), has_last_xr_rr(false) {} -RTCPSender::RTCPSender(const int32_t id, - const bool audio, +RTCPSender::RTCPSender(int32_t id, + bool audio, Clock* clock, - ReceiveStatistics* receive_statistics) : - _id(id), - _audio(audio), - _clock(clock), - _method(kRtcpOff), - _criticalSectionTransport(CriticalSectionWrapper::CreateCriticalSection()), - _cbTransport(NULL), + ReceiveStatistics* receive_statistics) + : _id(id), + _audio(audio), + _clock(clock), + _method(kRtcpOff), + _criticalSectionTransport( + CriticalSectionWrapper::CreateCriticalSection()), + _cbTransport(NULL), - _criticalSectionRTCPSender(CriticalSectionWrapper::CreateCriticalSection()), - _usingNack(false), - _sending(false), - _sendTMMBN(false), - _REMB(false), - _sendREMB(false), - _TMMBR(false), - _IJ(false), - _nextTimeToSendRTCP(0), - start_timestamp_(0), - last_rtp_timestamp_(0), - last_frame_capture_time_ms_(-1), - _SSRC(0), - _remoteSSRC(0), - _CNAME(), - receive_statistics_(receive_statistics), - internal_report_blocks_(), - external_report_blocks_(), - _csrcCNAMEs(), + _criticalSectionRTCPSender( + CriticalSectionWrapper::CreateCriticalSection()), + _usingNack(false), + _sending(false), + _sendTMMBN(false), + _REMB(false), + _sendREMB(false), + _TMMBR(false), + _IJ(false), + _nextTimeToSendRTCP(0), + start_timestamp_(0), + last_rtp_timestamp_(0), + last_frame_capture_time_ms_(-1), + _SSRC(0), + _remoteSSRC(0), + _CNAME(), + receive_statistics_(receive_statistics), + internal_report_blocks_(), + external_report_blocks_(), + _csrcCNAMEs(), - _cameraDelayMS(0), + _cameraDelayMS(0), - _lastSendReport(), - _lastRTCPTime(), + _lastSendReport(), + _lastRTCPTime(), - last_xr_rr_(), + last_xr_rr_(), - _sequenceNumberFIR(0), + _sequenceNumberFIR(0), - _rembBitrate(0), + _rembBitrate(0), - _tmmbrHelp(), - _tmmbr_Send(0), - _packetOH_Send(0), + _tmmbrHelp(), + _tmmbr_Send(0), + _packetOH_Send(0), - _appSend(false), - _appSubType(0), - _appName(), - _appData(NULL), - _appLength(0), + _appSend(false), + _appSubType(0), + _appName(), + _appData(NULL), + _appLength(0), - xrSendReceiverReferenceTimeEnabled_(false), - _xrSendVoIPMetric(false), - _xrVoIPMetric() -{ + xrSendReceiverReferenceTimeEnabled_(false), + _xrSendVoIPMetric(false), + _xrVoIPMetric() { memset(_CNAME, 0, sizeof(_CNAME)); memset(_lastSendReport, 0, sizeof(_lastSendReport)); memset(_lastRTCPTime, 0, sizeof(_lastRTCPTime)); @@ -175,24 +176,15 @@ RTCPSender::Status() const return _method; } -int32_t -RTCPSender::SetRTCPStatus(const RTCPMethod method) -{ - CriticalSectionScoped lock(_criticalSectionRTCPSender); - if(method != kRtcpOff) - { - if(_audio) - { - _nextTimeToSendRTCP = _clock->TimeInMilliseconds() + - (RTCP_INTERVAL_AUDIO_MS/2); - } else - { - _nextTimeToSendRTCP = _clock->TimeInMilliseconds() + - (RTCP_INTERVAL_VIDEO_MS/2); - } - } - _method = method; - return 0; +void RTCPSender::SetRTCPStatus(RTCPMethod method) { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + _method = method; + + if (method == kRtcpOff) + return; + _nextTimeToSendRTCP = + _clock->TimeInMilliseconds() + + (_audio ? RTCP_INTERVAL_AUDIO_MS / 2 : RTCP_INTERVAL_VIDEO_MS / 2); } bool @@ -233,27 +225,21 @@ RTCPSender::REMB() const return _REMB; } -int32_t -RTCPSender::SetREMBStatus(const bool enable) -{ - CriticalSectionScoped lock(_criticalSectionRTCPSender); - _REMB = enable; - return 0; +void RTCPSender::SetREMBStatus(bool enable) { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + _REMB = enable; } -int32_t -RTCPSender::SetREMBData(const uint32_t bitrate, - const std::vector& ssrcs) -{ - CriticalSectionScoped lock(_criticalSectionRTCPSender); - _rembBitrate = bitrate; - remb_ssrcs_ = ssrcs; +void RTCPSender::SetREMBData(uint32_t bitrate, + const std::vector& ssrcs) { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + _rembBitrate = bitrate; + remb_ssrcs_ = ssrcs; - _sendREMB = true; - // Send a REMB immediately if we have a new REMB. The frequency of REMBs is - // throttled by the caller. - _nextTimeToSendRTCP = _clock->TimeInMilliseconds(); - return 0; + _sendREMB = true; + // Send a REMB immediately if we have a new REMB. The frequency of REMBs is + // throttled by the caller. + _nextTimeToSendRTCP = _clock->TimeInMilliseconds(); } bool @@ -263,12 +249,9 @@ RTCPSender::TMMBR() const return _TMMBR; } -int32_t -RTCPSender::SetTMMBRStatus(const bool enable) -{ - CriticalSectionScoped lock(_criticalSectionRTCPSender); - _TMMBR = enable; - return 0; +void RTCPSender::SetTMMBRStatus(bool enable) { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + _TMMBR = enable; } bool @@ -278,12 +261,9 @@ RTCPSender::IJ() const return _IJ; } -int32_t -RTCPSender::SetIJStatus(const bool enable) -{ - CriticalSectionScoped lock(_criticalSectionRTCPSender); - _IJ = enable; - return 0; +void RTCPSender::SetIJStatus(bool enable) { + CriticalSectionScoped lock(_criticalSectionRTCPSender); + _IJ = enable; } void RTCPSender::SetStartTimestamp(uint32_t start_timestamp) { @@ -303,9 +283,7 @@ void RTCPSender::SetLastRtpTime(uint32_t rtp_timestamp, } } -void -RTCPSender::SetSSRC( const uint32_t ssrc) -{ +void RTCPSender::SetSSRC(uint32_t ssrc) { CriticalSectionScoped lock(_criticalSectionRTCPSender); if(_SSRC != 0) @@ -324,9 +302,7 @@ void RTCPSender::SetRemoteSSRC(uint32_t ssrc) _remoteSSRC = ssrc; } -int32_t -RTCPSender::SetCameraDelay(const int32_t delayMS) -{ +int32_t RTCPSender::SetCameraDelay(int32_t delayMS) { CriticalSectionScoped lock(_criticalSectionRTCPSender); if(delayMS > 1000 || delayMS < -1000) { @@ -348,7 +324,7 @@ int32_t RTCPSender::SetCNAME(const char cName[RTCP_CNAME_SIZE]) { return 0; } -int32_t RTCPSender::AddMixedCNAME(const uint32_t SSRC, +int32_t RTCPSender::AddMixedCNAME(uint32_t SSRC, const char cName[RTCP_CNAME_SIZE]) { assert(cName); CriticalSectionScoped lock(_criticalSectionRTCPSender); @@ -362,7 +338,7 @@ int32_t RTCPSender::AddMixedCNAME(const uint32_t SSRC, return 0; } -int32_t RTCPSender::RemoveMixedCNAME(const uint32_t SSRC) { +int32_t RTCPSender::RemoveMixedCNAME(uint32_t SSRC) { CriticalSectionScoped lock(_criticalSectionRTCPSender); std::map::iterator it = _csrcCNAMEs.find(SSRC); @@ -375,9 +351,7 @@ int32_t RTCPSender::RemoveMixedCNAME(const uint32_t SSRC) { return 0; } -bool -RTCPSender::TimeToSendRTCPReport(const bool sendKeyframeBeforeRTP) const -{ +bool RTCPSender::TimeToSendRTCPReport(bool sendKeyframeBeforeRTP) const { /* For audio we use a fix 5 sec interval @@ -473,9 +447,7 @@ RTCPSender::LastSendReport( uint32_t& lastRTCPTime) return _lastSendReport[0]; } -uint32_t -RTCPSender::SendTimeOfSendReport(const uint32_t sendReport) -{ +uint32_t RTCPSender::SendTimeOfSendReport(uint32_t sendReport) { CriticalSectionScoped lock(_criticalSectionRTCPSender); // This is only saved when we are the sender @@ -732,12 +704,10 @@ int32_t RTCPSender::BuildSDEC(uint8_t* rtcpbuffer, int& pos) { return 0; } -int32_t -RTCPSender::BuildRR(uint8_t* rtcpbuffer, - int& pos, - const uint32_t NTPsec, - const uint32_t NTPfrac) -{ +int32_t RTCPSender::BuildRR(uint8_t* rtcpbuffer, + int& pos, + uint32_t NTPsec, + uint32_t NTPfrac) { // sanity one block if(pos + 32 >= IP_PACKET_SIZE) { @@ -901,9 +871,7 @@ int32_t RTCPSender::BuildFIR(uint8_t* rtcpbuffer, | First | Number | PictureID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -int32_t -RTCPSender::BuildSLI(uint8_t* rtcpbuffer, int& pos, const uint8_t pictureID) -{ +int32_t RTCPSender::BuildSLI(uint8_t* rtcpbuffer, int& pos, uint8_t pictureID) { // sanity if(pos + 16 >= IP_PACKET_SIZE) { @@ -947,12 +915,10 @@ RTCPSender::BuildSLI(uint8_t* rtcpbuffer, int& pos, const uint8_t pictureID) /* * Note: not generic made for VP8 */ -int32_t -RTCPSender::BuildRPSI(uint8_t* rtcpbuffer, - int& pos, - const uint64_t pictureID, - const uint8_t payloadType) -{ +int32_t RTCPSender::BuildRPSI(uint8_t* rtcpbuffer, + int& pos, + uint64_t pictureID, + uint8_t payloadType) { // sanity if(pos + 24 >= IP_PACKET_SIZE) { @@ -1302,13 +1268,11 @@ RTCPSender::BuildAPP(uint8_t* rtcpbuffer, int& pos) return 0; } -int32_t -RTCPSender::BuildNACK(uint8_t* rtcpbuffer, - int& pos, - const int32_t nackSize, - const uint16_t* nackList, - std::string* nackString) -{ +int32_t RTCPSender::BuildNACK(uint8_t* rtcpbuffer, + int& pos, + int32_t nackSize, + const uint16_t* nackList, + std::string* nackString) { // sanity if(pos + 16 >= IP_PACKET_SIZE) { @@ -1981,10 +1945,7 @@ bool RTCPSender::PrepareReport(const FeedbackState& feedback_state, return true; } -int32_t -RTCPSender::SendToNetwork(const uint8_t* dataBuffer, - const size_t length) -{ +int32_t RTCPSender::SendToNetwork(const uint8_t* dataBuffer, size_t length) { CriticalSectionScoped lock(_criticalSectionTransport); if(_cbTransport) { @@ -2002,12 +1963,10 @@ void RTCPSender::SetCsrcs(const std::vector& csrcs) { csrcs_ = csrcs; } -int32_t -RTCPSender::SetApplicationSpecificData(const uint8_t subType, - const uint32_t name, - const uint8_t* data, - const uint16_t length) -{ +int32_t RTCPSender::SetApplicationSpecificData(uint8_t subType, + uint32_t name, + const uint8_t* data, + uint16_t length) { if(length %4 != 0) { LOG(LS_ERROR) << "Failed to SetApplicationSpecificData."; @@ -2050,12 +2009,11 @@ bool RTCPSender::RtcpXrReceiverReferenceTime() const { } // called under critsect _criticalSectionRTCPSender -int32_t RTCPSender::WriteAllReportBlocksToBuffer( - uint8_t* rtcpbuffer, - int pos, - uint8_t& numberOfReportBlocks, - const uint32_t NTPsec, - const uint32_t NTPfrac) { +int32_t RTCPSender::WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer, + int pos, + uint8_t& numberOfReportBlocks, + uint32_t NTPsec, + uint32_t NTPfrac) { numberOfReportBlocks = external_report_blocks_.size(); numberOfReportBlocks += internal_report_blocks_.size(); if ((pos + numberOfReportBlocks * 24) >= IP_PACKET_SIZE) { @@ -2116,10 +2074,8 @@ int32_t RTCPSender::WriteReportBlocksToBuffer( } // no callbacks allowed inside this function -int32_t -RTCPSender::SetTMMBN(const TMMBRSet* boundingSet, - const uint32_t maxBitrateKbit) -{ +int32_t RTCPSender::SetTMMBN(const TMMBRSet* boundingSet, + uint32_t maxBitrateKbit) { CriticalSectionScoped lock(_criticalSectionRTCPSender); if (0 == _tmmbrHelp.SetTMMBRBoundingSetToSend(boundingSet, maxBitrateKbit)) diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.h b/webrtc/modules/rtp_rtcp/source/rtcp_sender.h index f06a2fec3e..0cb08aa2e9 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.h @@ -69,45 +69,45 @@ public: // Used when generating TMMBR. ModuleRtpRtcpImpl* module; }; - RTCPSender(const int32_t id, const bool audio, - Clock* clock, - ReceiveStatistics* receive_statistics); + RTCPSender(int32_t id, + bool audio, + Clock* clock, + ReceiveStatistics* receive_statistics); virtual ~RTCPSender(); int32_t RegisterSendTransport(Transport* outgoingTransport); RTCPMethod Status() const; - int32_t SetRTCPStatus(const RTCPMethod method); + void SetRTCPStatus(RTCPMethod method); bool Sending() const; int32_t SetSendingStatus(const FeedbackState& feedback_state, bool enabled); // combine the functions - int32_t SetNackStatus(const bool enable); + int32_t SetNackStatus(bool enable); void SetStartTimestamp(uint32_t start_timestamp); void SetLastRtpTime(uint32_t rtp_timestamp, int64_t capture_time_ms); - void SetSSRC( const uint32_t ssrc); + void SetSSRC(uint32_t ssrc); void SetRemoteSSRC(uint32_t ssrc); - int32_t SetCameraDelay(const int32_t delayMS); + int32_t SetCameraDelay(int32_t delayMS); int32_t SetCNAME(const char cName[RTCP_CNAME_SIZE]); - int32_t AddMixedCNAME(const uint32_t SSRC, - const char cName[RTCP_CNAME_SIZE]); + int32_t AddMixedCNAME(uint32_t SSRC, const char cName[RTCP_CNAME_SIZE]); - int32_t RemoveMixedCNAME(const uint32_t SSRC); + int32_t RemoveMixedCNAME(uint32_t SSRC); - uint32_t SendTimeOfSendReport(const uint32_t sendReport); + uint32_t SendTimeOfSendReport(uint32_t sendReport); bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const; - bool TimeToSendRTCPReport(const bool sendKeyframeBeforeRTP = false) const; + bool TimeToSendRTCPReport(bool sendKeyframeBeforeRTP = false) const; uint32_t LastSendReport(uint32_t& lastRTCPTime); @@ -130,36 +130,34 @@ public: */ bool REMB() const; - int32_t SetREMBStatus(const bool enable); + void SetREMBStatus(bool enable); - int32_t SetREMBData(const uint32_t bitrate, - const std::vector& ssrcs); + void SetREMBData(uint32_t bitrate, const std::vector& ssrcs); /* * TMMBR */ bool TMMBR() const; - int32_t SetTMMBRStatus(const bool enable); + void SetTMMBRStatus(bool enable); - int32_t SetTMMBN(const TMMBRSet* boundingSet, - const uint32_t maxBitrateKbit); + int32_t SetTMMBN(const TMMBRSet* boundingSet, uint32_t maxBitrateKbit); /* * Extended jitter report */ bool IJ() const; - int32_t SetIJStatus(const bool enable); + void SetIJStatus(bool enable); /* * */ - int32_t SetApplicationSpecificData(const uint8_t subType, - const uint32_t name, + int32_t SetApplicationSpecificData(uint8_t subType, + uint32_t name, const uint8_t* data, - const uint16_t length); + uint16_t length); int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric); @@ -174,14 +172,14 @@ public: void GetPacketTypeCounter(RtcpPacketTypeCounter* packet_counter) const; private: - int32_t SendToNetwork(const uint8_t* dataBuffer, const size_t length); + int32_t SendToNetwork(const uint8_t* dataBuffer, size_t length); - int32_t WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer, - int pos, - uint8_t& numberOfReportBlocks, - const uint32_t NTPsec, - const uint32_t NTPfrac) - EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); + int32_t WriteAllReportBlocksToBuffer(uint8_t* rtcpbuffer, + int pos, + uint8_t& numberOfReportBlocks, + uint32_t NTPsec, + uint32_t NTPfrac) + EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); int32_t WriteReportBlocksToBuffer( uint8_t* rtcpbuffer, @@ -207,8 +205,8 @@ private: int32_t BuildRR(uint8_t* rtcpbuffer, int& pos, - const uint32_t NTPsec, - const uint32_t NTPfrac) + uint32_t NTPsec, + uint32_t NTPfrac) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); int PrepareRTCP( @@ -223,10 +221,9 @@ private: bool ShouldSendReportBlocks(uint32_t rtcp_packet_type) const; - int32_t BuildExtendedJitterReport( - uint8_t* rtcpbuffer, - int& pos, - const uint32_t jitterTransmissionTimeOffset) + int32_t BuildExtendedJitterReport(uint8_t* rtcpbuffer, + int& pos, + uint32_t jitterTransmissionTimeOffset) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); int32_t BuildSDEC(uint8_t* rtcpbuffer, int& pos) @@ -247,17 +244,17 @@ private: EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); int32_t BuildFIR(uint8_t* rtcpbuffer, int& pos, bool repeat) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); - int32_t BuildSLI(uint8_t* rtcpbuffer, int& pos, const uint8_t pictureID) + int32_t BuildSLI(uint8_t* rtcpbuffer, int& pos, uint8_t pictureID) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); int32_t BuildRPSI(uint8_t* rtcpbuffer, int& pos, - const uint64_t pictureID, - const uint8_t payloadType) + uint64_t pictureID, + uint8_t payloadType) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); int32_t BuildNACK(uint8_t* rtcpbuffer, int& pos, - const int32_t nackSize, + int32_t nackSize, const uint16_t* nackList, std::string* nackString) EXCLUSIVE_LOCKS_REQUIRED(_criticalSectionRTCPSender); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc index a72fe58ec6..699b09af35 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc @@ -340,15 +340,15 @@ class RtcpSenderTest : public ::testing::Test { }; TEST_F(RtcpSenderTest, RtcpOff) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpOff)); + rtcp_sender_->SetRTCPStatus(kRtcpOff); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(-1, rtcp_sender_->SendRTCP(feedback_state, kRtcpSr)); } TEST_F(RtcpSenderTest, IJStatus) { ASSERT_FALSE(rtcp_sender_->IJ()); - EXPECT_EQ(0, rtcp_sender_->SetIJStatus(true)); - ASSERT_TRUE(rtcp_sender_->IJ()); + rtcp_sender_->SetIJStatus(true); + EXPECT_TRUE(rtcp_sender_->IJ()); } TEST_F(RtcpSenderTest, TestCompound) { @@ -383,8 +383,8 @@ TEST_F(RtcpSenderTest, TestCompound) { EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, packet_, packet_length, payload_specific, true)); - EXPECT_EQ(0, rtcp_sender_->SetIJStatus(true)); - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetIJStatus(true); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRr)); @@ -394,8 +394,8 @@ TEST_F(RtcpSenderTest, TestCompound) { } TEST_F(RtcpSenderTest, TestCompound_NoRtpReceived) { - EXPECT_EQ(0, rtcp_sender_->SetIJStatus(true)); - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetIJStatus(true); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRr)); @@ -405,7 +405,7 @@ TEST_F(RtcpSenderTest, TestCompound_NoRtpReceived) { } TEST_F(RtcpSenderTest, TestXrReceiverReferenceTime) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, false)); rtcp_sender_->SendRtcpXrReceiverReferenceTime(true); @@ -416,7 +416,7 @@ TEST_F(RtcpSenderTest, TestXrReceiverReferenceTime) { } TEST_F(RtcpSenderTest, TestNoXrReceiverReferenceTimeIfSending) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, true)); rtcp_sender_->SendRtcpXrReceiverReferenceTime(true); @@ -427,7 +427,7 @@ TEST_F(RtcpSenderTest, TestNoXrReceiverReferenceTimeIfSending) { } TEST_F(RtcpSenderTest, TestNoXrReceiverReferenceTimeIfNotEnabled) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, false)); rtcp_sender_->SendRtcpXrReceiverReferenceTime(false); @@ -438,7 +438,7 @@ TEST_F(RtcpSenderTest, TestNoXrReceiverReferenceTimeIfNotEnabled) { } TEST_F(RtcpSenderTest, TestSendTimeOfXrRrReport) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, false)); rtcp_sender_->SendRtcpXrReceiverReferenceTime(true); @@ -475,7 +475,7 @@ TEST_F(RtcpSenderTest, TestSendTimeOfXrRrReport) { // See http://code.google.com/p/webrtc/issues/detail?id=468 for one // situation where this caused confusion. TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); TMMBRSet bounding_set; EXPECT_EQ(0, rtcp_sender_->SetTMMBN(&bounding_set, 3)); ASSERT_EQ(0U, test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags); @@ -494,7 +494,7 @@ TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndEmpty) { } TEST_F(RtcpSenderTest, SendsTmmbnIfSetAndValid) { - EXPECT_EQ(0, rtcp_sender_->SetRTCPStatus(kRtcpCompound)); + rtcp_sender_->SetRTCPStatus(kRtcpCompound); TMMBRSet bounding_set; bounding_set.VerifyAndAllocateSet(1); const uint32_t kSourceSsrc = 12345; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc index 642428e1f0..4dd74cee41 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc @@ -321,11 +321,9 @@ uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { } // Configure start timestamp, default is a random number. -int32_t ModuleRtpRtcpImpl::SetStartTimestamp( - const uint32_t timestamp) { +void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { rtcp_sender_.SetStartTimestamp(timestamp); rtp_sender_.SetStartTimestamp(timestamp, true); - return 0; // TODO(pwestin): change to void. } uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { @@ -333,10 +331,8 @@ uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { } // Set SequenceNumber, default is a random number. -int32_t ModuleRtpRtcpImpl::SetSequenceNumber( - const uint16_t seq_num) { +void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { rtp_sender_.SetSequenceNumber(seq_num); - return 0; // TODO(pwestin): change to void. } void ModuleRtpRtcpImpl::SetRtpStateForSsrc(uint32_t ssrc, @@ -467,9 +463,8 @@ bool ModuleRtpRtcpImpl::Sending() const { return rtcp_sender_.Sending(); } -int32_t ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { +void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { rtp_sender_.SetSendingMediaStatus(sending); - return 0; } bool ModuleRtpRtcpImpl::SendingMedia() const { @@ -705,11 +700,9 @@ RTCPMethod ModuleRtpRtcpImpl::RTCP() const { } // Configure RTCP status i.e on/off. -int32_t ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) { - if (rtcp_sender_.SetRTCPStatus(method) == 0) { - return rtcp_receiver_.SetRTCPStatus(method); - } - return -1; +void ModuleRtpRtcpImpl::SetRTCPStatus(const RTCPMethod method) { + rtcp_sender_.SetRTCPStatus(method); + rtcp_receiver_.SetRTCPStatus(method); } // Only for internal test. @@ -722,9 +715,8 @@ int32_t ModuleRtpRtcpImpl::SetCNAME(const char c_name[RTCP_CNAME_SIZE]) { return rtcp_sender_.SetCNAME(c_name); } -int32_t ModuleRtpRtcpImpl::AddMixedCNAME( - const uint32_t ssrc, - const char c_name[RTCP_CNAME_SIZE]) { +int32_t ModuleRtpRtcpImpl::AddMixedCNAME(uint32_t ssrc, + const char c_name[RTCP_CNAME_SIZE]) { return rtcp_sender_.AddMixedCNAME(ssrc, c_name); } @@ -859,13 +851,13 @@ bool ModuleRtpRtcpImpl::REMB() const { return rtcp_sender_.REMB(); } -int32_t ModuleRtpRtcpImpl::SetREMBStatus(const bool enable) { - return rtcp_sender_.SetREMBStatus(enable); +void ModuleRtpRtcpImpl::SetREMBStatus(const bool enable) { + rtcp_sender_.SetREMBStatus(enable); } -int32_t ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, - const std::vector& ssrcs) { - return rtcp_sender_.SetREMBData(bitrate, ssrcs); +void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, + const std::vector& ssrcs) { + rtcp_sender_.SetREMBData(bitrate, ssrcs); } // (IJ) Extended jitter report. @@ -873,8 +865,8 @@ bool ModuleRtpRtcpImpl::IJ() const { return rtcp_sender_.IJ(); } -int32_t ModuleRtpRtcpImpl::SetIJStatus(const bool enable) { - return rtcp_sender_.SetIJStatus(enable); +void ModuleRtpRtcpImpl::SetIJStatus(const bool enable) { + rtcp_sender_.SetIJStatus(enable); } int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( @@ -893,8 +885,8 @@ bool ModuleRtpRtcpImpl::TMMBR() const { return rtcp_sender_.TMMBR(); } -int32_t ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { - return rtcp_sender_.SetTMMBRStatus(enable); +void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { + rtcp_sender_.SetTMMBRStatus(enable); } int32_t ModuleRtpRtcpImpl::SetTMMBN(const TMMBRSet* bounding_set) { @@ -972,11 +964,9 @@ bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const { // Store the sent packets, needed to answer to a Negative acknowledgment // requests. -int32_t ModuleRtpRtcpImpl::SetStorePacketsStatus( - const bool enable, - const uint16_t number_to_store) { +void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, + const uint16_t number_to_store) { rtp_sender_.SetStorePacketsStatus(enable, number_to_store); - return 0; // TODO(pwestin): change to void. } bool ModuleRtpRtcpImpl::StorePackets() const { diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h index 4b11235726..ec067832f4 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h @@ -42,7 +42,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual int32_t IncomingRtcpPacket(const uint8_t* incoming_packet, size_t incoming_packet_length) OVERRIDE; - virtual void SetRemoteSSRC(const uint32_t ssrc) OVERRIDE; + virtual void SetRemoteSSRC(uint32_t ssrc) OVERRIDE; // Sender part. @@ -50,28 +50,27 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual int32_t RegisterSendPayload(const VideoCodec& video_codec) OVERRIDE; - virtual int32_t DeRegisterSendPayload(const int8_t payload_type) OVERRIDE; + virtual int32_t DeRegisterSendPayload(int8_t payload_type) OVERRIDE; int8_t SendPayloadType() const; // Register RTP header extension. - virtual int32_t RegisterSendRtpHeaderExtension( - const RTPExtensionType type, - const uint8_t id) OVERRIDE; + virtual int32_t RegisterSendRtpHeaderExtension(RTPExtensionType type, + uint8_t id) OVERRIDE; virtual int32_t DeregisterSendRtpHeaderExtension( - const RTPExtensionType type) OVERRIDE; + RTPExtensionType type) OVERRIDE; // Get start timestamp. virtual uint32_t StartTimestamp() const OVERRIDE; // Configure start timestamp, default is a random number. - virtual int32_t SetStartTimestamp(const uint32_t timestamp) OVERRIDE; + virtual void SetStartTimestamp(uint32_t timestamp) OVERRIDE; virtual uint16_t SequenceNumber() const OVERRIDE; // Set SequenceNumber, default is a random number. - virtual int32_t SetSequenceNumber(const uint16_t seq) OVERRIDE; + virtual void SetSequenceNumber(uint16_t seq) OVERRIDE; virtual void SetRtpStateForSsrc(uint32_t ssrc, const RtpState& rtp_state) OVERRIDE; @@ -80,7 +79,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual uint32_t SSRC() const OVERRIDE; // Configure SSRC, default is a random number. - virtual void SetSSRC(const uint32_t ssrc) OVERRIDE; + virtual void SetSSRC(uint32_t ssrc) OVERRIDE; virtual void SetCsrcs(const std::vector& csrcs) OVERRIDE; @@ -88,7 +87,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp { int CurrentSendFrequencyHz() const; - virtual void SetRTXSendStatus(const int mode) OVERRIDE; + virtual void SetRTXSendStatus(int mode) OVERRIDE; virtual void RTXSendStatus(int* mode, uint32_t* ssrc, int* payloadType) const OVERRIDE; @@ -98,24 +97,24 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual void SetRtxSendPayloadType(int payload_type) OVERRIDE; // Sends kRtcpByeCode when going from true to false. - virtual int32_t SetSendingStatus(const bool sending) OVERRIDE; + virtual int32_t SetSendingStatus(bool sending) OVERRIDE; virtual bool Sending() const OVERRIDE; // Drops or relays media packets. - virtual int32_t SetSendingMediaStatus(const bool sending) OVERRIDE; + virtual void SetSendingMediaStatus(bool sending) OVERRIDE; virtual bool SendingMedia() const OVERRIDE; // Used by the codec module to deliver a video or audio frame for // packetization. virtual int32_t SendOutgoingData( - const FrameType frame_type, - const int8_t payload_type, - const uint32_t time_stamp, + FrameType frame_type, + int8_t payload_type, + uint32_t time_stamp, int64_t capture_time_ms, const uint8_t* payload_data, - const size_t payload_size, + size_t payload_size, const RTPFragmentationHeader* fragmentation = NULL, const RTPVideoHeader* rtp_video_hdr = NULL) OVERRIDE; @@ -136,13 +135,13 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual RTCPMethod RTCP() const OVERRIDE; // Configure RTCP status i.e on/off. - virtual int32_t SetRTCPStatus(const RTCPMethod method) OVERRIDE; + virtual void SetRTCPStatus(RTCPMethod method) OVERRIDE; // Set RTCP CName. virtual int32_t SetCNAME(const char c_name[RTCP_CNAME_SIZE]) OVERRIDE; // Get remote CName. - virtual int32_t RemoteCNAME(const uint32_t remote_ssrc, + virtual int32_t RemoteCNAME(uint32_t remote_ssrc, char c_name[RTCP_CNAME_SIZE]) const OVERRIDE; // Get remote NTP. @@ -152,13 +151,13 @@ class ModuleRtpRtcpImpl : public RtpRtcp { uint32_t* rtcp_arrival_time_frac, uint32_t* rtcp_timestamp) const OVERRIDE; - virtual int32_t AddMixedCNAME(const uint32_t ssrc, + virtual int32_t AddMixedCNAME(uint32_t ssrc, const char c_name[RTCP_CNAME_SIZE]) OVERRIDE; - virtual int32_t RemoveMixedCNAME(const uint32_t ssrc) OVERRIDE; + virtual int32_t RemoveMixedCNAME(uint32_t ssrc) OVERRIDE; // Get RoundTripTime. - virtual int32_t RTT(const uint32_t remote_ssrc, + virtual int32_t RTT(uint32_t remote_ssrc, uint16_t* rtt, uint16_t* avg_rtt, uint16_t* min_rtt, @@ -187,9 +186,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp { // Set received RTCP report block. virtual int32_t AddRTCPReportBlock( - const uint32_t ssrc, const RTCPReportBlock* receive_block) OVERRIDE; + uint32_t ssrc, + const RTCPReportBlock* receive_block) OVERRIDE; - virtual int32_t RemoveRTCPReportBlock(const uint32_t ssrc) OVERRIDE; + virtual int32_t RemoveRTCPReportBlock(uint32_t ssrc) OVERRIDE; virtual void GetRtcpPacketTypeCounters( RtcpPacketTypeCounter* packets_sent, @@ -198,20 +198,20 @@ class ModuleRtpRtcpImpl : public RtpRtcp { // (REMB) Receiver Estimated Max Bitrate. virtual bool REMB() const OVERRIDE; - virtual int32_t SetREMBStatus(const bool enable) OVERRIDE; + virtual void SetREMBStatus(bool enable) OVERRIDE; - virtual int32_t SetREMBData(const uint32_t bitrate, - const std::vector& ssrcs) OVERRIDE; + virtual void SetREMBData(uint32_t bitrate, + const std::vector& ssrcs) OVERRIDE; // (IJ) Extended jitter report. virtual bool IJ() const OVERRIDE; - virtual int32_t SetIJStatus(const bool enable) OVERRIDE; + virtual void SetIJStatus(bool enable) OVERRIDE; // (TMMBR) Temporary Max Media Bit Rate. virtual bool TMMBR() const OVERRIDE; - virtual int32_t SetTMMBRStatus(const bool enable) OVERRIDE; + virtual void SetTMMBRStatus(bool enable) OVERRIDE; int32_t SetTMMBN(const TMMBRSet* bounding_set); @@ -219,12 +219,12 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual uint16_t MaxDataPayloadLength() const OVERRIDE; - virtual int32_t SetMaxTransferUnit(const uint16_t size) OVERRIDE; + virtual int32_t SetMaxTransferUnit(uint16_t size) OVERRIDE; virtual int32_t SetTransportOverhead( - const bool tcp, - const bool ipv6, - const uint8_t authentication_overhead = 0) OVERRIDE; + bool tcp, + bool ipv6, + uint8_t authentication_overhead = 0) OVERRIDE; // (NACK) Negative acknowledgment part. @@ -233,13 +233,12 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual int SetSelectiveRetransmissions(uint8_t settings) OVERRIDE; // Send a Negative acknowledgment packet. - virtual int32_t SendNACK(const uint16_t* nack_list, - const uint16_t size) OVERRIDE; + virtual int32_t SendNACK(const uint16_t* nack_list, uint16_t size) OVERRIDE; // Store the sent packets, needed to answer to a negative acknowledgment // requests. - virtual int32_t SetStorePacketsStatus( - const bool enable, const uint16_t number_to_store) OVERRIDE; + virtual void SetStorePacketsStatus(bool enable, + uint16_t number_to_store) OVERRIDE; virtual bool StorePackets() const OVERRIDE; @@ -249,11 +248,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp { virtual RtcpStatisticsCallback* GetRtcpStatisticsCallback() OVERRIDE; // (APP) Application specific data. - virtual int32_t SetRTCPApplicationSpecificData( - const uint8_t sub_type, - const uint32_t name, - const uint8_t* data, - const uint16_t length) OVERRIDE; + virtual int32_t SetRTCPApplicationSpecificData(uint8_t sub_type, + uint32_t name, + const uint8_t* data, + uint16_t length) OVERRIDE; // (XR) VOIP metric. virtual int32_t SetRTCPVoIPMetrics(const RTCPVoIPMetric* VoIPMetric) OVERRIDE; @@ -267,47 +265,44 @@ class ModuleRtpRtcpImpl : public RtpRtcp { // Set audio packet size, used to determine when it's time to send a DTMF // packet in silence (CNG). - virtual int32_t SetAudioPacketSize( - const uint16_t packet_size_samples) OVERRIDE; + virtual int32_t SetAudioPacketSize(uint16_t packet_size_samples) OVERRIDE; virtual bool SendTelephoneEventActive(int8_t& telephone_event) const OVERRIDE; // Send a TelephoneEvent tone using RFC 2833 (4733). - virtual int32_t SendTelephoneEventOutband(const uint8_t key, - const uint16_t time_ms, - const uint8_t level) OVERRIDE; + virtual int32_t SendTelephoneEventOutband(uint8_t key, + uint16_t time_ms, + uint8_t level) OVERRIDE; // Set payload type for Redundant Audio Data RFC 2198. - virtual int32_t SetSendREDPayloadType(const int8_t payload_type) OVERRIDE; + virtual int32_t SetSendREDPayloadType(int8_t payload_type) OVERRIDE; // Get payload type for Redundant Audio Data RFC 2198. virtual int32_t SendREDPayloadType(int8_t& payload_type) const OVERRIDE; // Store the audio level in d_bov for header-extension-for-audio-level- // indication. - virtual int32_t SetAudioLevel(const uint8_t level_d_bov) OVERRIDE; + virtual int32_t SetAudioLevel(uint8_t level_d_bov) OVERRIDE; // Video part. - virtual int32_t SendRTCPSliceLossIndication( - const uint8_t picture_id) OVERRIDE; + virtual int32_t SendRTCPSliceLossIndication(uint8_t picture_id) OVERRIDE; // Set method for requestion a new key frame. virtual int32_t SetKeyFrameRequestMethod( - const KeyFrameRequestMethod method) OVERRIDE; + KeyFrameRequestMethod method) OVERRIDE; // Send a request for a keyframe. virtual int32_t RequestKeyFrame() OVERRIDE; - virtual int32_t SetCameraDelay(const int32_t delay_ms) OVERRIDE; + virtual int32_t SetCameraDelay(int32_t delay_ms) OVERRIDE; virtual void SetTargetSendBitrate( const std::vector& stream_bitrates) OVERRIDE; - virtual int32_t SetGenericFECStatus( - const bool enable, - const uint8_t payload_type_red, - const uint8_t payload_type_fec) OVERRIDE; + virtual int32_t SetGenericFECStatus(bool enable, + uint8_t payload_type_red, + uint8_t payload_type_fec) OVERRIDE; virtual int32_t GenericFECStatus( bool& enable, @@ -331,13 +326,13 @@ class ModuleRtpRtcpImpl : public RtpRtcp { uint32_t* fec_rate, uint32_t* nackRate) const OVERRIDE; - uint32_t SendTimeOfSendReport(const uint32_t send_report); + uint32_t SendTimeOfSendReport(uint32_t send_report); bool SendTimeOfXrRrReport(uint32_t mid_ntp, int64_t* time_ms) const; // Good state of RTP receiver inform sender. virtual int32_t SendRTCPReferencePictureSelection( - const uint64_t picture_id) OVERRIDE; + uint64_t picture_id) OVERRIDE; virtual void RegisterSendChannelRtpStatisticsCallback( StreamDataCountersCallback* callback) OVERRIDE; @@ -350,11 +345,10 @@ class ModuleRtpRtcpImpl : public RtpRtcp { void OnRequestIntraFrame(); // Received a request for a new SLI. - void OnReceivedSliceLossIndication(const uint8_t picture_id); + void OnReceivedSliceLossIndication(uint8_t picture_id); // Received a new reference frame. - void OnReceivedReferencePictureSelectionIndication( - const uint64_t picture_id); + void OnReceivedReferencePictureSelectionIndication(uint64_t picture_id); void OnReceivedNACK(const std::list& nack_sequence_numbers); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc index f1d060462d..3f9e95fa08 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl_unittest.cc @@ -110,7 +110,7 @@ class RtpRtcpModule { config.rtt_stats = &rtt_stats_; impl_.reset(new ModuleRtpRtcpImpl(config)); - EXPECT_EQ(0, impl_->SetRTCPStatus(kRtcpCompound)); + impl_->SetRTCPStatus(kRtcpCompound); transport_.SimulateNetworkDelay(kOneWayNetworkDelayMs, clock); } @@ -150,7 +150,7 @@ class RtpRtcpImplTest : public ::testing::Test { receiver_(&clock_) { // Send module. EXPECT_EQ(0, sender_.impl_->SetSendingStatus(true)); - EXPECT_EQ(0, sender_.impl_->SetSendingMediaStatus(true)); + sender_.impl_->SetSendingMediaStatus(true); sender_.impl_->SetSSRC(kSenderSsrc); sender_.impl_->SetRemoteSSRC(kReceiverSsrc); sender_.impl_->SetSequenceNumber(kSequenceNumber); @@ -165,7 +165,7 @@ class RtpRtcpImplTest : public ::testing::Test { // Receive module. EXPECT_EQ(0, receiver_.impl_->SetSendingStatus(false)); - EXPECT_EQ(0, receiver_.impl_->SetSendingMediaStatus(false)); + receiver_.impl_->SetSendingMediaStatus(false); receiver_.impl_->SetSSRC(kReceiverSsrc); receiver_.impl_->SetRemoteSSRC(kSenderSsrc); // Transport settings. @@ -580,7 +580,7 @@ class RtpSendingTest : public ::testing::Test { RtpRtcp* sender = RtpRtcp::CreateRtpRtcp(config); EXPECT_EQ(0, sender->RegisterSendPayload(codec_)); EXPECT_EQ(0, sender->SetSendingStatus(true)); - EXPECT_EQ(0, sender->SetSendingMediaStatus(true)); + sender->SetSendingMediaStatus(true); sender->SetSSRC(kSenderSsrc + i); sender->SetRemoteSSRC(kReceiverSsrc + i); senders_.push_back(sender); diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc index 172bd4d5a0..a1810f24f1 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc @@ -27,7 +27,7 @@ const int kSendSideDelayWindowMs = 1000; namespace { -const char* FrameTypeToString(const FrameType frame_type) { +const char* FrameTypeToString(FrameType frame_type) { switch (frame_type) { case kFrameEmpty: return "empty"; case kAudioFrameSpeech: return "audio_speech"; @@ -91,8 +91,8 @@ class BitrateAggregator { uint32_t ssrc_; }; -RTPSender::RTPSender(const int32_t id, - const bool audio, +RTPSender::RTPSender(int32_t id, + bool audio, Clock* clock, Transport* transport, RtpAudioFeedback* audio_feedback, @@ -236,8 +236,7 @@ bool RTPSender::GetSendSideDelay(int* avg_send_delay_ms, return true; } -int32_t RTPSender::SetTransmissionTimeOffset( - const int32_t transmission_time_offset) { +int32_t RTPSender::SetTransmissionTimeOffset(int32_t transmission_time_offset) { if (transmission_time_offset > (0x800000 - 1) || transmission_time_offset < -(0x800000 - 1)) { // Word24. return -1; @@ -247,8 +246,7 @@ int32_t RTPSender::SetTransmissionTimeOffset( return 0; } -int32_t RTPSender::SetAbsoluteSendTime( - const uint32_t absolute_send_time) { +int32_t RTPSender::SetAbsoluteSendTime(uint32_t absolute_send_time) { if (absolute_send_time > 0xffffff) { // UWord24. return -1; } @@ -257,14 +255,13 @@ int32_t RTPSender::SetAbsoluteSendTime( return 0; } -int32_t RTPSender::RegisterRtpHeaderExtension(const RTPExtensionType type, - const uint8_t id) { +int32_t RTPSender::RegisterRtpHeaderExtension(RTPExtensionType type, + uint8_t id) { CriticalSectionScoped cs(send_critsect_); return rtp_header_extension_map_.Register(type, id); } -int32_t RTPSender::DeregisterRtpHeaderExtension( - const RTPExtensionType type) { +int32_t RTPSender::DeregisterRtpHeaderExtension(RTPExtensionType type) { CriticalSectionScoped cs(send_critsect_); return rtp_header_extension_map_.Deregister(type); } @@ -276,8 +273,10 @@ size_t RTPSender::RtpHeaderExtensionTotalLength() const { int32_t RTPSender::RegisterPayload( const char payload_name[RTP_PAYLOAD_NAME_SIZE], - const int8_t payload_number, const uint32_t frequency, - const uint8_t channels, const uint32_t rate) { + int8_t payload_number, + uint32_t frequency, + uint8_t channels, + uint32_t rate) { assert(payload_name); CriticalSectionScoped cs(send_critsect_); @@ -321,8 +320,7 @@ int32_t RTPSender::RegisterPayload( return ret_val; } -int32_t RTPSender::DeRegisterSendPayload( - const int8_t payload_type) { +int32_t RTPSender::DeRegisterSendPayload(int8_t payload_type) { CriticalSectionScoped lock(send_critsect_); std::map::iterator it = @@ -351,9 +349,8 @@ int RTPSender::SendPayloadFrequency() const { return audio_ != NULL ? audio_->AudioFrequency() : kVideoPayloadTypeFrequency; } -int32_t RTPSender::SetMaxPayloadLength( - const size_t max_payload_length, - const uint16_t packet_over_head) { +int32_t RTPSender::SetMaxPayloadLength(size_t max_payload_length, + uint16_t packet_over_head) { // Sanity check. if (max_payload_length < 100 || max_payload_length > IP_PACKET_SIZE) { LOG(LS_ERROR) << "Invalid max payload length: " << max_payload_length; @@ -414,8 +411,8 @@ void RTPSender::SetRtxPayloadType(int payload_type) { payload_type_rtx_ = payload_type; } -int32_t RTPSender::CheckPayloadType(const int8_t payload_type, - RtpVideoCodecTypes *video_type) { +int32_t RTPSender::CheckPayloadType(int8_t payload_type, + RtpVideoCodecTypes* video_type) { CriticalSectionScoped cs(send_critsect_); if (payload_type < 0) { @@ -455,12 +452,15 @@ int32_t RTPSender::CheckPayloadType(const int8_t payload_type, return 0; } -int32_t RTPSender::SendOutgoingData( - const FrameType frame_type, const int8_t payload_type, - const uint32_t capture_timestamp, int64_t capture_time_ms, - const uint8_t *payload_data, const size_t payload_size, - const RTPFragmentationHeader *fragmentation, - VideoCodecInformation *codec_info, const RTPVideoTypeHeader *rtp_type_hdr) { +int32_t RTPSender::SendOutgoingData(FrameType frame_type, + int8_t payload_type, + uint32_t capture_timestamp, + int64_t capture_time_ms, + const uint8_t* payload_data, + size_t payload_size, + const RTPFragmentationHeader* fragmentation, + VideoCodecInformation* codec_info, + const RTPVideoTypeHeader* rtp_type_hdr) { uint32_t ssrc; { // Drop this packet if we're not sending media packets. @@ -645,8 +645,7 @@ size_t RTPSender::SendPadData(uint32_t timestamp, return bytes_sent; } -void RTPSender::SetStorePacketsStatus(const bool enable, - const uint16_t number_to_store) { +void RTPSender::SetStorePacketsStatus(bool enable, uint16_t number_to_store) { packet_history_.SetStorePacketsStatus(enable, number_to_store); } @@ -720,9 +719,8 @@ int RTPSender::SetSelectiveRetransmissions(uint8_t settings) { return video_->SetSelectiveRetransmissions(settings); } -void RTPSender::OnReceivedNACK( - const std::list& nack_sequence_numbers, - const uint16_t avg_rtt) { +void RTPSender::OnReceivedNACK(const std::list& nack_sequence_numbers, + uint16_t avg_rtt) { TRACE_EVENT2("webrtc_rtp", "RTPSender::OnReceivedNACK", "num_seqnum", nack_sequence_numbers.size(), "avg_rtt", avg_rtt); const int64_t now = clock_->TimeInMilliseconds(); @@ -766,7 +764,7 @@ void RTPSender::OnReceivedNACK( } } -bool RTPSender::ProcessNACKBitRate(const uint32_t now) { +bool RTPSender::ProcessNACKBitRate(uint32_t now) { uint32_t num = 0; size_t byte_count = 0; const uint32_t kAvgIntervalMs = 1000; @@ -1121,12 +1119,12 @@ size_t RTPSender::CreateRtpHeader(uint8_t* header, } int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer, - const int8_t payload_type, - const bool marker_bit, - const uint32_t capture_timestamp, + int8_t payload_type, + bool marker_bit, + uint32_t capture_timestamp, int64_t capture_time_ms, - const bool timestamp_provided, - const bool inc_sequence_number) { + bool timestamp_provided, + bool inc_sequence_number) { assert(payload_type >= 0); CriticalSectionScoped cs(send_critsect_); @@ -1306,9 +1304,10 @@ uint8_t RTPSender::BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const { return kAbsoluteSendTimeLength; } -void RTPSender::UpdateTransmissionTimeOffset( - uint8_t *rtp_packet, const size_t rtp_packet_length, - const RTPHeader &rtp_header, const int64_t time_diff_ms) const { +void RTPSender::UpdateTransmissionTimeOffset(uint8_t* rtp_packet, + size_t rtp_packet_length, + const RTPHeader& rtp_header, + int64_t time_diff_ms) const { CriticalSectionScoped cs(send_critsect_); // Get id. uint8_t id = 0; @@ -1352,11 +1351,11 @@ void RTPSender::UpdateTransmissionTimeOffset( time_diff_ms * 90); // RTP timestamp. } -bool RTPSender::UpdateAudioLevel(uint8_t *rtp_packet, - const size_t rtp_packet_length, - const RTPHeader &rtp_header, - const bool is_voiced, - const uint8_t dBov) const { +bool RTPSender::UpdateAudioLevel(uint8_t* rtp_packet, + size_t rtp_packet_length, + const RTPHeader& rtp_header, + bool is_voiced, + uint8_t dBov) const { CriticalSectionScoped cs(send_critsect_); // Get id. @@ -1395,9 +1394,10 @@ bool RTPSender::UpdateAudioLevel(uint8_t *rtp_packet, return true; } -void RTPSender::UpdateAbsoluteSendTime( - uint8_t *rtp_packet, const size_t rtp_packet_length, - const RTPHeader &rtp_header, const int64_t now_ms) const { +void RTPSender::UpdateAbsoluteSendTime(uint8_t* rtp_packet, + size_t rtp_packet_length, + const RTPHeader& rtp_header, + int64_t now_ms) const { CriticalSectionScoped cs(send_critsect_); // Get id. @@ -1464,7 +1464,7 @@ void RTPSender::SetSendingStatus(bool enabled) { } } -void RTPSender::SetSendingMediaStatus(const bool enabled) { +void RTPSender::SetSendingMediaStatus(bool enabled) { CriticalSectionScoped cs(send_critsect_); sending_media_ = enabled; } @@ -1549,9 +1549,9 @@ uint16_t RTPSender::SequenceNumber() const { } // Audio. -int32_t RTPSender::SendTelephoneEvent(const uint8_t key, - const uint16_t time_ms, - const uint8_t level) { +int32_t RTPSender::SendTelephoneEvent(uint8_t key, + uint16_t time_ms, + uint8_t level) { if (!audio_configured_) { return -1; } @@ -1565,19 +1565,18 @@ bool RTPSender::SendTelephoneEventActive(int8_t *telephone_event) const { return audio_->SendTelephoneEventActive(*telephone_event); } -int32_t RTPSender::SetAudioPacketSize( - const uint16_t packet_size_samples) { +int32_t RTPSender::SetAudioPacketSize(uint16_t packet_size_samples) { if (!audio_configured_) { return -1; } return audio_->SetAudioPacketSize(packet_size_samples); } -int32_t RTPSender::SetAudioLevel(const uint8_t level_d_bov) { +int32_t RTPSender::SetAudioLevel(uint8_t level_d_bov) { return audio_->SetAudioLevel(level_d_bov); } -int32_t RTPSender::SetRED(const int8_t payload_type) { +int32_t RTPSender::SetRED(int8_t payload_type) { if (!audio_configured_) { return -1; } @@ -1618,9 +1617,9 @@ int32_t RTPSender::SendRTPIntraRequest() { return video_->SendRTPIntraRequest(); } -int32_t RTPSender::SetGenericFECStatus( - const bool enable, const uint8_t payload_type_red, - const uint8_t payload_type_fec) { +int32_t RTPSender::SetGenericFECStatus(bool enable, + uint8_t payload_type_red, + uint8_t payload_type_fec) { if (audio_configured_) { return -1; } diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.h b/webrtc/modules/rtp_rtcp/source/rtp_sender.h index 8babb66710..2703fea760 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_sender.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.h @@ -45,12 +45,12 @@ class RTPSenderInterface { virtual uint32_t Timestamp() const = 0; virtual int32_t BuildRTPheader(uint8_t* data_buffer, - const int8_t payload_type, - const bool marker_bit, - const uint32_t capture_timestamp, + int8_t payload_type, + bool marker_bit, + uint32_t capture_timestamp, int64_t capture_time_ms, - const bool timestamp_provided = true, - const bool inc_sequence_number = true) = 0; + bool timestamp_provided = true, + bool inc_sequence_number = true) = 0; virtual size_t RTPHeaderLength() const = 0; virtual uint16_t IncrementSequenceNumber() = 0; @@ -68,9 +68,12 @@ class RTPSenderInterface { class RTPSender : public RTPSenderInterface { public: - RTPSender(const int32_t id, const bool audio, Clock *clock, - Transport *transport, RtpAudioFeedback *audio_feedback, - PacedSender *paced_sender, + RTPSender(int32_t id, + bool audio, + Clock* clock, + Transport* transport, + RtpAudioFeedback* audio_feedback, + PacedSender* paced_sender, BitrateStatisticsObserver* bitrate_callback, FrameCountObserver* frame_count_observer, SendSideDelayObserver* send_side_delay_observer); @@ -109,7 +112,7 @@ class RTPSender : public RTPSenderInterface { void SetSendingStatus(bool enabled); - void SetSendingMediaStatus(const bool enabled); + void SetSendingMediaStatus(bool enabled); bool SendingMedia() const; void GetDataCounters(StreamDataCounters* rtp_stats, @@ -121,36 +124,32 @@ class RTPSender : public RTPSenderInterface { void SetStartTimestamp(uint32_t timestamp, bool force); uint32_t GenerateNewSSRC(); - void SetSSRC(const uint32_t ssrc); + void SetSSRC(uint32_t ssrc); virtual uint16_t SequenceNumber() const OVERRIDE; void SetSequenceNumber(uint16_t seq); void SetCsrcs(const std::vector& csrcs); - int32_t SetMaxPayloadLength(const size_t length, - const uint16_t packet_over_head); + int32_t SetMaxPayloadLength(size_t length, uint16_t packet_over_head); - int32_t SendOutgoingData(const FrameType frame_type, - const int8_t payload_type, - const uint32_t timestamp, + int32_t SendOutgoingData(FrameType frame_type, + int8_t payload_type, + uint32_t timestamp, int64_t capture_time_ms, const uint8_t* payload_data, - const size_t payload_size, + size_t payload_size, const RTPFragmentationHeader* fragmentation, VideoCodecInformation* codec_info = NULL, const RTPVideoTypeHeader* rtp_type_hdr = NULL); // RTP header extension - int32_t SetTransmissionTimeOffset( - const int32_t transmission_time_offset); - int32_t SetAbsoluteSendTime( - const uint32_t absolute_send_time); + int32_t SetTransmissionTimeOffset(int32_t transmission_time_offset); + int32_t SetAbsoluteSendTime(uint32_t absolute_send_time); - int32_t RegisterRtpHeaderExtension(const RTPExtensionType type, - const uint8_t id); + int32_t RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id); - int32_t DeregisterRtpHeaderExtension(const RTPExtensionType type); + int32_t DeregisterRtpHeaderExtension(RTPExtensionType type); size_t RtpHeaderExtensionTotalLength() const; @@ -160,11 +159,11 @@ class RTPSender : public RTPSenderInterface { uint8_t BuildAudioLevelExtension(uint8_t* data_buffer) const; uint8_t BuildAbsoluteSendTimeExtension(uint8_t* data_buffer) const; - bool UpdateAudioLevel(uint8_t *rtp_packet, - const size_t rtp_packet_length, - const RTPHeader &rtp_header, - const bool is_voiced, - const uint8_t dBov) const; + bool UpdateAudioLevel(uint8_t* rtp_packet, + size_t rtp_packet_length, + const RTPHeader& rtp_header, + bool is_voiced, + uint8_t dBov) const; bool TimeToSendPacket(uint16_t sequence_number, int64_t capture_time_ms, bool retransmission); @@ -174,16 +173,15 @@ class RTPSender : public RTPSenderInterface { int SelectiveRetransmissions() const; int SetSelectiveRetransmissions(uint8_t settings); void OnReceivedNACK(const std::list& nack_sequence_numbers, - const uint16_t avg_rtt); + uint16_t avg_rtt); - void SetStorePacketsStatus(const bool enable, - const uint16_t number_to_store); + void SetStorePacketsStatus(bool enable, uint16_t number_to_store); bool StorePackets() const; int32_t ReSendPacket(uint16_t packet_id, uint32_t min_resend_time = 0); - bool ProcessNACKBitRate(const uint32_t now); + bool ProcessNACKBitRate(uint32_t now); // RTX. void SetRTXStatus(int mode); @@ -198,9 +196,9 @@ class RTPSender : public RTPSenderInterface { // Functions wrapping RTPSenderInterface. virtual int32_t BuildRTPheader( uint8_t* data_buffer, - const int8_t payload_type, - const bool marker_bit, - const uint32_t capture_timestamp, + int8_t payload_type, + bool marker_bit, + uint32_t capture_timestamp, int64_t capture_time_ms, const bool timestamp_provided = true, const bool inc_sequence_number = true) OVERRIDE; @@ -222,22 +220,20 @@ class RTPSender : public RTPSenderInterface { // Audio. // Send a DTMF tone using RFC 2833 (4733). - int32_t SendTelephoneEvent(const uint8_t key, - const uint16_t time_ms, - const uint8_t level); + int32_t SendTelephoneEvent(uint8_t key, uint16_t time_ms, uint8_t level); bool SendTelephoneEventActive(int8_t *telephone_event) const; // Set audio packet size, used to determine when it's time to send a DTMF // packet in silence (CNG). - int32_t SetAudioPacketSize(const uint16_t packet_size_samples); + int32_t SetAudioPacketSize(uint16_t packet_size_samples); // Store the audio level in d_bov for // header-extension-for-audio-level-indication. - int32_t SetAudioLevel(const uint8_t level_d_bov); + int32_t SetAudioLevel(uint8_t level_d_bov); // Set payload type for Redundant Audio Data RFC 2198. - int32_t SetRED(const int8_t payload_type); + int32_t SetRED(int8_t payload_type); // Get payload type for Redundant Audio Data RFC 2198. int32_t RED(int8_t *payload_type) const; @@ -252,9 +248,9 @@ class RTPSender : public RTPSenderInterface { int32_t SendRTPIntraRequest(); // FEC. - int32_t SetGenericFECStatus(const bool enable, - const uint8_t payload_type_red, - const uint8_t payload_type_fec); + int32_t SetGenericFECStatus(bool enable, + uint8_t payload_type_red, + uint8_t payload_type_fec); int32_t GenericFECStatus(bool *enable, uint8_t *payload_type_red, uint8_t *payload_type_fec) const; @@ -278,8 +274,7 @@ class RTPSender : public RTPSenderInterface { RtpState GetRtxRtpState() const; protected: - int32_t CheckPayloadType(const int8_t payload_type, - RtpVideoCodecTypes *video_type); + int32_t CheckPayloadType(int8_t payload_type, RtpVideoCodecTypes* video_type); private: // Maps capture time in milliseconds to send-side delay in milliseconds. @@ -317,14 +312,14 @@ class RTPSender : public RTPSenderInterface { void UpdateDelayStatistics(int64_t capture_time_ms, int64_t now_ms); - void UpdateTransmissionTimeOffset(uint8_t *rtp_packet, - const size_t rtp_packet_length, - const RTPHeader &rtp_header, - const int64_t time_diff_ms) const; - void UpdateAbsoluteSendTime(uint8_t *rtp_packet, - const size_t rtp_packet_length, - const RTPHeader &rtp_header, - const int64_t now_ms) const; + void UpdateTransmissionTimeOffset(uint8_t* rtp_packet, + size_t rtp_packet_length, + const RTPHeader& rtp_header, + int64_t time_diff_ms) const; + void UpdateAbsoluteSendTime(uint8_t* rtp_packet, + size_t rtp_packet_length, + const RTPHeader& rtp_header, + int64_t now_ms) const; void UpdateRtpStats(const uint8_t* buffer, size_t packet_length, diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc index 1621203b37..ccc8cf26ac 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc @@ -55,10 +55,10 @@ class RtpRtcpAPITest : public ::testing::Test { }; TEST_F(RtpRtcpAPITest, Basic) { - EXPECT_EQ(0, module->SetSequenceNumber(test_sequence_number)); + module->SetSequenceNumber(test_sequence_number); EXPECT_EQ(test_sequence_number, module->SequenceNumber()); - EXPECT_EQ(0, module->SetStartTimestamp(test_timestamp)); + module->SetStartTimestamp(test_timestamp); EXPECT_EQ(test_timestamp, module->StartTimestamp()); EXPECT_FALSE(module->Sending()); @@ -86,15 +86,15 @@ TEST_F(RtpRtcpAPITest, SSRC) { TEST_F(RtpRtcpAPITest, RTCP) { EXPECT_EQ(kRtcpOff, module->RTCP()); - EXPECT_EQ(0, module->SetRTCPStatus(kRtcpCompound)); + module->SetRTCPStatus(kRtcpCompound); EXPECT_EQ(kRtcpCompound, module->RTCP()); EXPECT_EQ(0, module->SetCNAME("john.doe@test.test")); EXPECT_FALSE(module->TMMBR()); - EXPECT_EQ(0, module->SetTMMBRStatus(true)); + module->SetTMMBRStatus(true); EXPECT_TRUE(module->TMMBR()); - EXPECT_EQ(0, module->SetTMMBRStatus(false)); + module->SetTMMBRStatus(false); EXPECT_FALSE(module->TMMBR()); EXPECT_EQ(kNackOff, rtp_receiver_->NACK()); diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc index 49ee83a7db..706812be15 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc @@ -168,7 +168,7 @@ class RtpRtcpAudioTest : public ::testing::Test { TEST_F(RtpRtcpAudioTest, Basic) { module1->SetSSRC(test_ssrc); - EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp)); + module1->SetStartTimestamp(test_timestamp); // Test detection at the end of a DTMF tone. //EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true)); @@ -239,7 +239,7 @@ TEST_F(RtpRtcpAudioTest, RED) { (voice_codec.rate < 0) ? 0 : voice_codec.rate)); module1->SetSSRC(test_ssrc); - EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp)); + module1->SetStartTimestamp(test_timestamp); EXPECT_EQ(0, module1->SetSendingStatus(true)); voice_codec.pltype = 127; @@ -312,7 +312,7 @@ TEST_F(RtpRtcpAudioTest, DTMF) { (voice_codec.rate < 0) ? 0 : voice_codec.rate)); module1->SetSSRC(test_ssrc); - EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp)); + module1->SetStartTimestamp(test_timestamp); EXPECT_EQ(0, module1->SetSendingStatus(true)); // Prepare for DTMF. diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc index 96a6691415..bf06d7fb06 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc @@ -126,13 +126,13 @@ class RtpRtcpRtcpTest : public ::testing::Test { myRTCPFeedback1->SetModule(module1); myRTCPFeedback2->SetModule(module2); - EXPECT_EQ(0, module1->SetRTCPStatus(kRtcpCompound)); - EXPECT_EQ(0, module2->SetRTCPStatus(kRtcpCompound)); + module1->SetRTCPStatus(kRtcpCompound); + module2->SetRTCPStatus(kRtcpCompound); module2->SetSSRC(test_ssrc + 1); module1->SetSSRC(test_ssrc); - EXPECT_EQ(0, module1->SetSequenceNumber(test_sequence_number)); - EXPECT_EQ(0, module1->SetStartTimestamp(test_timestamp)); + module1->SetSequenceNumber(test_sequence_number); + module1->SetStartTimestamp(test_timestamp); module1->SetCsrcs(test_csrcs); EXPECT_EQ(0, module1->SetCNAME("john.doe@test.test")); diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc index ddcfa9674c..59c36d33ff 100644 --- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc +++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc @@ -50,10 +50,10 @@ class RtpRtcpVideoTest : public ::testing::Test { rtp_receiver_.reset(RtpReceiver::CreateVideoReceiver( test_id_, &fake_clock, receiver_, NULL, &rtp_payload_registry_)); - EXPECT_EQ(0, video_module_->SetRTCPStatus(kRtcpCompound)); + video_module_->SetRTCPStatus(kRtcpCompound); video_module_->SetSSRC(test_ssrc_); rtp_receiver_->SetNACKStatus(kNackRtcp); - EXPECT_EQ(0, video_module_->SetStorePacketsStatus(true, 600)); + video_module_->SetStorePacketsStatus(true, 600); EXPECT_EQ(0, video_module_->SetSendingStatus(true)); transport_->SetSendModule(video_module_, &rtp_payload_registry_, diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index ab6453a697..6708eadfc5 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -166,9 +166,7 @@ int32_t ViEChannel::Init() { return -1; } // RTP/RTCP initialization. - if (rtp_rtcp_->SetSendingMediaStatus(false) != 0) { - return -1; - } + rtp_rtcp_->SetSendingMediaStatus(false); if (module_process_thread_.RegisterModule(rtp_rtcp_.get()) != 0) { return -1; } @@ -617,7 +615,7 @@ int32_t ViEChannel::SetSignalPacketLossStatus(bool enable, return 0; } -int32_t ViEChannel::SetRTCPMode(const RTCPMethod rtcp_mode) { +void ViEChannel::SetRTCPMode(const RTCPMethod rtcp_mode) { CriticalSectionScoped cs(rtp_rtcp_cs_.get()); for (std::list::iterator it = simulcast_rtp_rtcp_.begin(); it != simulcast_rtp_rtcp_.end(); @@ -625,12 +623,11 @@ int32_t ViEChannel::SetRTCPMode(const RTCPMethod rtcp_mode) { RtpRtcp* rtp_rtcp = *it; rtp_rtcp->SetRTCPStatus(rtcp_mode); } - return rtp_rtcp_->SetRTCPStatus(rtcp_mode); + rtp_rtcp_->SetRTCPStatus(rtcp_mode); } -int32_t ViEChannel::GetRTCPMode(RTCPMethod* rtcp_mode) { - *rtcp_mode = rtp_rtcp_->RTCP(); - return 0; +RTCPMethod ViEChannel::GetRTCPMode() const { + return rtp_rtcp_->RTCP(); } int32_t ViEChannel::SetNACKStatus(const bool enable) { @@ -751,9 +748,7 @@ int ViEChannel::SetSenderBufferingMode(int target_delay_ms) { nack_history_size_sender_ = kSendSidePacketHistorySize; } } - if (rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_) != 0) { - return -1; - } + rtp_rtcp_->SetStorePacketsStatus(true, nack_history_size_sender_); return 0; } @@ -796,10 +791,8 @@ int32_t ViEChannel::SetKeyFrameRequestMethod( return rtp_rtcp_->SetKeyFrameRequestMethod(method); } -bool ViEChannel::EnableRemb(bool enable) { - if (rtp_rtcp_->SetREMBStatus(enable) != 0) - return false; - return true; +void ViEChannel::EnableRemb(bool enable) { + rtp_rtcp_->SetREMBStatus(enable); } int ViEChannel::SetSendTimestampOffsetStatus(bool enable, int id) { @@ -882,8 +875,8 @@ void ViEChannel::SetTransmissionSmoothingStatus(bool enable) { paced_sender_->SetStatus(enable); } -int32_t ViEChannel::EnableTMMBR(const bool enable) { - return rtp_rtcp_->SetTMMBRStatus(enable); +void ViEChannel::EnableTMMBR(bool enable) { + rtp_rtcp_->SetTMMBRStatus(enable); } int32_t ViEChannel::EnableKeyFrameRequestCallback(const bool enable) { @@ -994,7 +987,8 @@ int32_t ViEChannel::SetStartSequenceNumber(uint16_t sequence_number) { if (rtp_rtcp_->Sending()) { return -1; } - return rtp_rtcp_->SetSequenceNumber(sequence_number); + rtp_rtcp_->SetSequenceNumber(sequence_number); + return 0; } void ViEChannel::SetRtpStateForSsrc(uint32_t ssrc, const RtpState& rtp_state) { diff --git a/webrtc/video_engine/vie_channel.h b/webrtc/video_engine/vie_channel.h index dda08eebef..d3cc3665dd 100644 --- a/webrtc/video_engine/vie_channel.h +++ b/webrtc/video_engine/vie_channel.h @@ -107,8 +107,8 @@ class ViEChannel // key frames. int32_t SetSignalPacketLossStatus(bool enable, bool only_key_frames); - int32_t SetRTCPMode(const RTCPMethod rtcp_mode); - int32_t GetRTCPMode(RTCPMethod* rtcp_mode); + void SetRTCPMode(const RTCPMethod rtcp_mode); + RTCPMethod GetRTCPMode() const; int32_t SetNACKStatus(const bool enable); int32_t SetFECStatus(const bool enable, const unsigned char payload_typeRED, @@ -119,7 +119,7 @@ class ViEChannel int SetSenderBufferingMode(int target_delay_ms); int SetReceiverBufferingMode(int target_delay_ms); int32_t SetKeyFrameRequestMethod(const KeyFrameRequestMethod method); - bool EnableRemb(bool enable); + void EnableRemb(bool enable); int SetSendTimestampOffsetStatus(bool enable, int id); int SetReceiveTimestampOffsetStatus(bool enable, int id); int SetSendAbsoluteSendTimeStatus(bool enable, int id); @@ -127,7 +127,7 @@ class ViEChannel bool GetReceiveAbsoluteSendTimeStatus() const; void SetRtcpXrRrtrStatus(bool enable); void SetTransmissionSmoothingStatus(bool enable); - int32_t EnableTMMBR(const bool enable); + void EnableTMMBR(bool enable); int32_t EnableKeyFrameRequestCallback(const bool enable); // Sets SSRC for outgoing stream. diff --git a/webrtc/video_engine/vie_channel_group.cc b/webrtc/video_engine/vie_channel_group.cc index 1a4e50fa73..d4a3f20d11 100644 --- a/webrtc/video_engine/vie_channel_group.cc +++ b/webrtc/video_engine/vie_channel_group.cc @@ -226,16 +226,12 @@ EncoderStateFeedback* ChannelGroup::GetEncoderStateFeedback() { return encoder_state_feedback_.get(); } -bool ChannelGroup::SetChannelRembStatus(int channel_id, bool sender, - bool receiver, ViEChannel* channel) { +void ChannelGroup::SetChannelRembStatus(int channel_id, + bool sender, + bool receiver, + ViEChannel* channel) { // Update the channel state. - if (sender || receiver) { - if (!channel->EnableRemb(true)) { - return false; - } - } else { - channel->EnableRemb(false); - } + channel->EnableRemb(sender || receiver); // Update the REMB instance with necessary RTP modules. RtpRtcp* rtp_module = channel->rtp_rtcp(); if (sender) { @@ -248,7 +244,6 @@ bool ChannelGroup::SetChannelRembStatus(int channel_id, bool sender, } else { remb_->RemoveReceiveChannel(rtp_module); } - return true; } void ChannelGroup::SetBandwidthEstimationConfig(const webrtc::Config& config) { diff --git a/webrtc/video_engine/vie_channel_group.h b/webrtc/video_engine/vie_channel_group.h index 40ce71ef19..33214508d1 100644 --- a/webrtc/video_engine/vie_channel_group.h +++ b/webrtc/video_engine/vie_channel_group.h @@ -40,7 +40,9 @@ class ChannelGroup { bool HasChannel(int channel_id); bool Empty(); - bool SetChannelRembStatus(int channel_id, bool sender, bool receiver, + void SetChannelRembStatus(int channel_id, + bool sender, + bool receiver, ViEChannel* channel); void SetBandwidthEstimationConfig(const webrtc::Config& config); diff --git a/webrtc/video_engine/vie_channel_manager.cc b/webrtc/video_engine/vie_channel_manager.cc index 6f35c24f61..dc3f916605 100644 --- a/webrtc/video_engine/vie_channel_manager.cc +++ b/webrtc/video_engine/vie_channel_manager.cc @@ -348,7 +348,8 @@ bool ViEChannelManager::SetRembStatus(int channel_id, bool sender, ViEChannel* channel = ViEChannelPtr(channel_id); assert(channel); - return group->SetChannelRembStatus(channel_id, sender, receiver, channel); + group->SetChannelRembStatus(channel_id, sender, receiver, channel); + return true; } bool ViEChannelManager::SetReservedTransmitBitrate( diff --git a/webrtc/video_engine/vie_rtp_rtcp_impl.cc b/webrtc/video_engine/vie_rtp_rtcp_impl.cc index 617d6ea5ea..49999a982a 100644 --- a/webrtc/video_engine/vie_rtp_rtcp_impl.cc +++ b/webrtc/video_engine/vie_rtp_rtcp_impl.cc @@ -292,10 +292,7 @@ int ViERTP_RTCPImpl::SetRTCPStatus(const int video_channel, } RTCPMethod module_mode = ViERTCPModeToRTCPMethod(rtcp_mode); - if (vie_channel->SetRTCPMode(module_mode) != 0) { - shared_data_->SetLastError(kViERtpRtcpUnknownError); - return -1; - } + vie_channel->SetRTCPMode(module_mode); return 0; } @@ -307,11 +304,7 @@ int ViERTP_RTCPImpl::GetRTCPStatus(const int video_channel, shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); return -1; } - RTCPMethod module_mode = kRtcpOff; - if (vie_channel->GetRTCPMode(&module_mode) != 0) { - shared_data_->SetLastError(kViERtpRtcpUnknownError); - return -1; - } + RTCPMethod module_mode = vie_channel->GetRTCPMode(); rtcp_mode = RTCPMethodToViERTCPMode(module_mode); return 0; } @@ -370,8 +363,8 @@ int ViERTP_RTCPImpl::SendApplicationDefinedRTCPPacket( shared_data_->SetLastError(kViERtpRtcpNotSending); return -1; } - RTCPMethod method; - if (vie_channel->GetRTCPMode(&method) != 0 || method == kRtcpOff) { + RTCPMethod method = vie_channel->GetRTCPMode(); + if (method == kRtcpOff) { shared_data_->SetLastError(kViERtpRtcpRtcpDisabled); return -1; } @@ -545,10 +538,7 @@ int ViERTP_RTCPImpl::SetTMMBRStatus(const int video_channel, shared_data_->SetLastError(kViERtpRtcpInvalidChannelId); return -1; } - if (vie_channel->EnableTMMBR(enable) != 0) { - shared_data_->SetLastError(kViERtpRtcpUnknownError); - return -1; - } + vie_channel->EnableTMMBR(enable); return 0; } diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index a570922aca..7900ac911c 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -957,15 +957,8 @@ Channel::Init() // be transmitted since the Transport object will then be invalid. telephone_event_handler_->SetTelephoneEventForwardToDecoder(true); // RTCP is enabled by default. - if (_rtpRtcpModule->SetRTCPStatus(kRtcpCompound) == -1) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, kTraceError, - "Channel::Init() RTP/RTCP module not initialized"); - return -1; - } - - // --- Register all permanent callbacks + _rtpRtcpModule->SetRTCPStatus(kRtcpCompound); + // --- Register all permanent callbacks const bool fail = (audio_coding_->RegisterTransportCallback(this) == -1) || (audio_coding_->RegisterVADCallback(this) == -1); @@ -2908,20 +2901,10 @@ int Channel::SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id) { return 0; } -int -Channel::SetRTCPStatus(bool enable) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::SetRTCPStatus()"); - if (_rtpRtcpModule->SetRTCPStatus(enable ? - kRtcpCompound : kRtcpOff) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, kTraceError, - "SetRTCPStatus() failed to set RTCP status"); - return -1; - } - return 0; +void Channel::SetRTCPStatus(bool enable) { + WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), + "Channel::SetRTCPStatus()"); + _rtpRtcpModule->SetRTCPStatus(enable ? kRtcpCompound : kRtcpOff); } int @@ -3807,47 +3790,28 @@ int Channel::GetPlayoutTimestamp(unsigned int& timestamp) { return 0; } -int -Channel::SetInitTimestamp(unsigned int timestamp) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), +int Channel::SetInitTimestamp(unsigned int timestamp) { + WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), "Channel::SetInitTimestamp()"); - if (channel_state_.Get().sending) - { - _engineStatisticsPtr->SetLastError( - VE_SENDING, kTraceError, "SetInitTimestamp() already sending"); - return -1; - } - if (_rtpRtcpModule->SetStartTimestamp(timestamp) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, kTraceError, - "SetInitTimestamp() failed to set timestamp"); - return -1; - } - return 0; + if (channel_state_.Get().sending) { + _engineStatisticsPtr->SetLastError(VE_SENDING, kTraceError, + "SetInitTimestamp() already sending"); + return -1; + } + _rtpRtcpModule->SetStartTimestamp(timestamp); + return 0; } -int -Channel::SetInitSequenceNumber(short sequenceNumber) -{ - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId), - "Channel::SetInitSequenceNumber()"); - if (channel_state_.Get().sending) - { - _engineStatisticsPtr->SetLastError( - VE_SENDING, kTraceError, - "SetInitSequenceNumber() already sending"); - return -1; - } - if (_rtpRtcpModule->SetSequenceNumber(sequenceNumber) != 0) - { - _engineStatisticsPtr->SetLastError( - VE_RTP_RTCP_MODULE_ERROR, kTraceError, - "SetInitSequenceNumber() failed to set sequence number"); - return -1; - } - return 0; +int Channel::SetInitSequenceNumber(short sequenceNumber) { + WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, _channelId), + "Channel::SetInitSequenceNumber()"); + if (channel_state_.Get().sending) { + _engineStatisticsPtr->SetLastError( + VE_SENDING, kTraceError, "SetInitSequenceNumber() already sending"); + return -1; + } + _rtpRtcpModule->SetSequenceNumber(sequenceNumber); + return 0; } int diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index b729d71dc6..57ae563630 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -319,7 +319,7 @@ public: int SetReceiveAudioLevelIndicationStatus(bool enable, unsigned char id); int SetSendAbsoluteSenderTimeStatus(bool enable, unsigned char id); int SetReceiveAbsoluteSenderTimeStatus(bool enable, unsigned char id); - int SetRTCPStatus(bool enable); + void SetRTCPStatus(bool enable); int GetRTCPStatus(bool& enabled); int SetRTCP_CNAME(const char cName[256]); int GetRemoteRTCP_CNAME(char cName[256]); diff --git a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc index 370e6007de..7bac2609d1 100644 --- a/webrtc/voice_engine/voe_rtp_rtcp_impl.cc +++ b/webrtc/voice_engine/voe_rtp_rtcp_impl.cc @@ -249,7 +249,8 @@ int VoERTP_RTCPImpl::SetRTCPStatus(int channel, bool enable) "SetRTCPStatus() failed to locate channel"); return -1; } - return channelPtr->SetRTCPStatus(enable); + channelPtr->SetRTCPStatus(enable); + return 0; } int VoERTP_RTCPImpl::GetRTCPStatus(int channel, bool& enabled)