modules/rtp_rtcp/include folder cleared of lint warnings

Functions that do not follow lint are marked deprecated, including function in the interface.

BUG=webrtc:5308
R=mflodman@webrtc.org

Review URL: https://codereview.webrtc.org/1493403003

Cr-Commit-Position: refs/heads/master@{#10975}
This commit is contained in:
danilchap 2015-12-10 09:51:54 -08:00 committed by Commit bot
parent 796cfaf7f7
commit 5c1def8892
12 changed files with 113 additions and 131 deletions

View File

@ -54,7 +54,7 @@ class RTPPayloadStrategy {
class RTPPayloadRegistry {
public:
// The registry takes ownership of the strategy.
RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy);
explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy);
~RTPPayloadRegistry();
int32_t RegisterReceivePayload(
@ -110,8 +110,16 @@ class RTPPayloadRegistry {
int GetPayloadTypeFrequency(uint8_t payload_type) const;
// DEPRECATED. Use PayloadTypeToPayload below that returns const Payload*
// instead of taking output parameter.
// TODO(danilchap): Remove this when all callers have been updated.
bool PayloadTypeToPayload(const uint8_t payload_type,
RtpUtility::Payload*& payload) const;
RtpUtility::Payload*& payload) const { // NOLINT
payload =
const_cast<RtpUtility::Payload*>(PayloadTypeToPayload(payload_type));
return payload != nullptr;
}
const RtpUtility::Payload* PayloadTypeToPayload(uint8_t payload_type) const;
void ResetLastReceivedPayloadTypes() {
CriticalSectionScoped cs(crit_sect_.get());
@ -147,7 +155,7 @@ class RTPPayloadRegistry {
int8_t last_received_media_payload_type() const {
CriticalSectionScoped cs(crit_sect_.get());
return last_received_media_payload_type_;
};
}
bool use_rtx_payload_mapping_on_restore() const {
CriticalSectionScoped cs(crit_sect_.get());

View File

@ -581,9 +581,13 @@ class RtpRtcp : public Module {
*
* return -1 on failure else 0
*/
virtual int32_t SendREDPayloadType(
int8_t& payloadType) const = 0;
// DEPRECATED. Use SendREDPayloadType below that takes output parameter
// by pointer instead of by reference.
// TODO(danilchap): Remove this when all callers have been updated.
int32_t SendREDPayloadType(int8_t& payloadType) const { // NOLINT
return SendREDPayloadType(&payloadType);
}
virtual int32_t SendREDPayloadType(int8_t* payload_type) const = 0;
/*
* Store the audio level in dBov for header-extension-for-audio-level-
* indication.
@ -615,10 +619,17 @@ class RtpRtcp : public Module {
/*
* Get generic FEC setting
*/
virtual void GenericFECStatus(bool& enable,
uint8_t& payloadTypeRED,
uint8_t& payloadTypeFEC) = 0;
// DEPRECATED. Use GenericFECStatus below that takes output parameters
// by pointers instead of by references.
// TODO(danilchap): Remove this when all callers have been updated.
void GenericFECStatus(bool& enable, // NOLINT
uint8_t& payloadTypeRED, // NOLINT
uint8_t& payloadTypeFEC) { // NOLINT
GenericFECStatus(&enable, &payloadTypeRED, &payloadTypeFEC);
}
virtual void GenericFECStatus(bool* enable,
uint8_t* payload_type_red,
uint8_t* payload_type_fec) = 0;
virtual int32_t SetFecParameters(
const FecProtectionParams* delta_params,
@ -639,4 +650,4 @@ class RtpRtcp : public Module {
virtual int32_t RequestKeyFrame() = 0;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_
#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_H_

View File

@ -33,31 +33,23 @@ const int kVideoPayloadTypeFrequency = 90000;
// Minimum RTP header size in bytes.
const uint8_t kRtpHeaderSize = 12;
struct AudioPayload
{
struct AudioPayload {
uint32_t frequency;
uint8_t channels;
uint32_t rate;
};
struct VideoPayload
{
struct VideoPayload {
RtpVideoCodecTypes videoCodecType;
uint32_t maxRate;
};
union PayloadUnion
{
union PayloadUnion {
AudioPayload Audio;
VideoPayload Video;
};
enum RTPAliveType
{
kRtpDead = 0,
kRtpNoRtp = 1,
kRtpAlive = 2
};
enum RTPAliveType { kRtpDead = 0, kRtpNoRtp = 1, kRtpAlive = 2 };
enum ProtectionType {
kUnprotectedPacket,
@ -78,10 +70,7 @@ enum RTPExtensionType {
kRtpExtensionTransportSequenceNumber,
};
enum RTCPAppSubTypes
{
kAppSubtypeBwe = 0x00
};
enum RTCPAppSubTypes { kAppSubtypeBwe = 0x00 };
// TODO(sprang): Make this an enum class once rtcp_receiver has been cleaned up.
enum RTCPPacketType : uint32_t {
@ -109,17 +98,9 @@ enum RTCPPacketType : uint32_t {
enum KeyFrameRequestMethod { kKeyFrameReqPliRtcp, kKeyFrameReqFirRtcp };
enum RtpRtcpPacketType
{
kPacketRtp = 0,
kPacketKeepAlive = 1
};
enum RtpRtcpPacketType { kPacketRtp = 0, kPacketKeepAlive = 1 };
enum NACKMethod
{
kNackOff = 0,
kNackRtcp = 2
};
enum NACKMethod { kNackOff = 0, kNackRtcp = 2 };
enum RetransmissionMode : uint8_t {
kRetransmitOff = 0x0,
@ -138,8 +119,7 @@ enum RtxMode {
const size_t kRtxHeaderSize = 2;
struct RTCPSenderInfo
{
struct RTCPSenderInfo {
uint32_t NTPseconds;
uint32_t NTPfraction;
uint32_t RTPtimeStamp;
@ -206,40 +186,36 @@ struct RtpState {
bool media_has_been_sent;
};
class RtpData
{
public:
virtual ~RtpData() {}
class RtpData {
public:
virtual ~RtpData() {}
virtual int32_t OnReceivedPayloadData(
const uint8_t* payloadData,
const size_t payloadSize,
const WebRtcRTPHeader* rtpHeader) = 0;
virtual int32_t OnReceivedPayloadData(const uint8_t* payloadData,
const size_t payloadSize,
const WebRtcRTPHeader* rtpHeader) = 0;
virtual bool OnRecoveredPacket(const uint8_t* packet,
size_t packet_length) = 0;
virtual bool OnRecoveredPacket(const uint8_t* packet,
size_t packet_length) = 0;
};
class RtpFeedback
{
public:
virtual ~RtpFeedback() {}
class RtpFeedback {
public:
virtual ~RtpFeedback() {}
// Receiving payload change or SSRC change. (return success!)
/*
* channels - number of channels in codec (1 = mono, 2 = stereo)
*/
virtual int32_t OnInitializeDecoder(
const int8_t payloadType,
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int frequency,
const uint8_t channels,
const uint32_t rate) = 0;
// Receiving payload change or SSRC change. (return success!)
/*
* channels - number of channels in codec (1 = mono, 2 = stereo)
*/
virtual int32_t OnInitializeDecoder(
const int8_t payloadType,
const char payloadName[RTP_PAYLOAD_NAME_SIZE],
const int frequency,
const uint8_t channels,
const uint32_t rate) = 0;
virtual void OnIncomingSSRCChanged(const uint32_t ssrc) = 0;
virtual void OnIncomingSSRCChanged(const uint32_t ssrc) = 0;
virtual void OnIncomingCSRCChanged(const uint32_t CSRC,
const bool added) = 0;
virtual void OnIncomingCSRCChanged(const uint32_t CSRC, const bool added) = 0;
};
class RtpAudioFeedback {
@ -346,7 +322,7 @@ class RtcpRttStats {
virtual int64_t LastProcessedRtt() const = 0;
virtual ~RtcpRttStats() {};
virtual ~RtcpRttStats() {}
};
// Null object version of RtpFeedback.
@ -437,4 +413,4 @@ class TransportSequenceNumberAllocator {
};
} // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_
#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_RTCP_DEFINES_H_

View File

@ -218,8 +218,7 @@ class MockRtpRtcp : public RtpRtcp {
int32_t(const uint8_t key, const uint16_t time_ms, const uint8_t level));
MOCK_METHOD1(SetSendREDPayloadType,
int32_t(const int8_t payloadType));
MOCK_CONST_METHOD1(SendREDPayloadType,
int32_t(int8_t& payloadType));
MOCK_CONST_METHOD1(SendREDPayloadType, int32_t(int8_t* payloadType));
MOCK_METHOD2(SetRTPAudioLevelIndicationStatus,
int32_t(const bool enable, const uint8_t ID));
MOCK_CONST_METHOD2(GetRTPAudioLevelIndicationStatus,
@ -233,9 +232,9 @@ class MockRtpRtcp : public RtpRtcp {
const uint8_t payload_type_red,
const uint8_t payload_type_fec));
MOCK_METHOD3(GenericFECStatus,
void(bool& enable,
uint8_t& payloadTypeRED,
uint8_t& payloadTypeFEC));
void(bool* enable,
uint8_t* payloadTypeRED,
uint8_t* payloadTypeFEC));
MOCK_METHOD2(SetFecParameters,
int32_t(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params));

View File

@ -343,17 +343,16 @@ bool RTPPayloadRegistry::GetPayloadSpecifics(uint8_t payload_type,
int RTPPayloadRegistry::GetPayloadTypeFrequency(
uint8_t payload_type) const {
RtpUtility::Payload* payload;
if (!PayloadTypeToPayload(payload_type, payload)) {
const RtpUtility::Payload* payload = PayloadTypeToPayload(payload_type);
if (!payload) {
return -1;
}
CriticalSectionScoped cs(crit_sect_.get());
return rtp_payload_strategy_->GetPayloadTypeFrequency(*payload);
}
bool RTPPayloadRegistry::PayloadTypeToPayload(
const uint8_t payload_type,
RtpUtility::Payload*& payload) const {
const RtpUtility::Payload* RTPPayloadRegistry::PayloadTypeToPayload(
uint8_t payload_type) const {
CriticalSectionScoped cs(crit_sect_.get());
RtpUtility::PayloadTypeMap::const_iterator it =
@ -361,11 +360,10 @@ bool RTPPayloadRegistry::PayloadTypeToPayload(
// Check that this is a registered payload type.
if (it == payload_type_map_.end()) {
return false;
return nullptr;
}
payload = it->second;
return true;
return it->second;
}
void RTPPayloadRegistry::SetIncomingPayloadType(const RTPHeader& header) {

View File

@ -74,9 +74,9 @@ TEST_F(RtpPayloadRegistryTest, RegistersAndRemembersPayloadsUntilDeregistered) {
EXPECT_TRUE(new_payload_created) << "A new payload WAS created.";
RtpUtility::Payload* retrieved_payload = NULL;
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type,
retrieved_payload));
const RtpUtility::Payload* retrieved_payload =
rtp_payload_registry_->PayloadTypeToPayload(payload_type);
EXPECT_TRUE(retrieved_payload);
// We should get back the exact pointer to the payload returned by the
// payload strategy.
@ -84,8 +84,7 @@ TEST_F(RtpPayloadRegistryTest, RegistersAndRemembersPayloadsUntilDeregistered) {
// Now forget about it and verify it's gone.
EXPECT_EQ(0, rtp_payload_registry_->DeRegisterReceivePayload(payload_type));
EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload(payload_type,
retrieved_payload));
EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload(payload_type));
}
TEST_F(RtpPayloadRegistryTest, AudioRedWorkProperly) {
@ -106,10 +105,9 @@ TEST_F(RtpPayloadRegistryTest, AudioRedWorkProperly) {
EXPECT_EQ(kRedPayloadType, rtp_payload_registry_->red_payload_type());
RtpUtility::Payload* retrieved_payload = NULL;
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(kRedPayloadType,
retrieved_payload));
ASSERT_TRUE(retrieved_payload);
const RtpUtility::Payload* retrieved_payload =
rtp_payload_registry_->PayloadTypeToPayload(kRedPayloadType);
EXPECT_TRUE(retrieved_payload);
EXPECT_TRUE(retrieved_payload->audio);
EXPECT_STRCASEEQ("red", retrieved_payload->name);
@ -142,12 +140,13 @@ TEST_F(RtpPayloadRegistryTest,
<< "With a different payload type is fine though.";
// Ensure both payloads are preserved.
RtpUtility::Payload* retrieved_payload = NULL;
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type,
retrieved_payload));
const RtpUtility::Payload* retrieved_payload =
rtp_payload_registry_->PayloadTypeToPayload(payload_type);
EXPECT_TRUE(retrieved_payload);
EXPECT_EQ(first_payload_on_heap, retrieved_payload);
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1,
retrieved_payload));
retrieved_payload =
rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1);
EXPECT_TRUE(retrieved_payload);
EXPECT_EQ(second_payload_on_heap, retrieved_payload);
// Ok, update the rate for one of the codecs. If either the incoming rate or
@ -181,13 +180,10 @@ TEST_F(RtpPayloadRegistryTest,
kTypicalPayloadName, payload_type - 1, kTypicalFrequency,
kTypicalChannels, kTypicalRate, &ignored));
RtpUtility::Payload* retrieved_payload = NULL;
EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload(payload_type,
retrieved_payload))
EXPECT_FALSE(rtp_payload_registry_->PayloadTypeToPayload(payload_type))
<< "The first payload should be "
"deregistered because the only thing that differs is payload type.";
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1,
retrieved_payload))
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1))
<< "The second payload should still be registered though.";
// Now ensure non-compatible codecs aren't removed.
@ -198,11 +194,9 @@ TEST_F(RtpPayloadRegistryTest,
kTypicalPayloadName, payload_type + 1, kTypicalFrequency,
kTypicalChannels, kTypicalRate, &ignored));
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1,
retrieved_payload))
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type - 1))
<< "Not compatible; both payloads should be kept.";
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type + 1,
retrieved_payload))
EXPECT_TRUE(rtp_payload_registry_->PayloadTypeToPayload(payload_type + 1))
<< "Not compatible; both payloads should be kept.";
}

View File

@ -276,12 +276,11 @@ void RtpReceiverImpl::CheckSSRCChanged(const RTPHeader& rtp_header) {
if (rtp_header.payloadType == last_received_payload_type) {
re_initialize_decoder = true;
Payload* payload;
if (!rtp_payload_registry_->PayloadTypeToPayload(
rtp_header.payloadType, payload)) {
const Payload* payload = rtp_payload_registry_->PayloadTypeToPayload(
rtp_header.payloadType);
if (!payload) {
return;
}
assert(payload);
payload_name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload_name, payload->name, RTP_PAYLOAD_NAME_SIZE - 1);
if (payload->audio) {
@ -365,12 +364,12 @@ int32_t RtpReceiverImpl::CheckPayloadChanged(const RTPHeader& rtp_header,
return 0;
}
Payload* payload;
if (!rtp_payload_registry_->PayloadTypeToPayload(payload_type, payload)) {
const Payload* payload =
rtp_payload_registry_->PayloadTypeToPayload(payload_type);
if (!payload) {
// Not a registered payload type.
return -1;
}
assert(payload);
payload_name[RTP_PAYLOAD_NAME_SIZE - 1] = 0;
strncpy(payload_name, payload->name, RTP_PAYLOAD_NAME_SIZE - 1);

View File

@ -800,9 +800,8 @@ int32_t ModuleRtpRtcpImpl::SetSendREDPayloadType(
}
// Get payload type for Redundant Audio Data RFC 2198.
int32_t ModuleRtpRtcpImpl::SendREDPayloadType(
int8_t& payload_type) const {
return rtp_sender_.RED(&payload_type);
int32_t ModuleRtpRtcpImpl::SendREDPayloadType(int8_t* payload_type) const {
return rtp_sender_.RED(payload_type);
}
void ModuleRtpRtcpImpl::SetTargetSendBitrate(uint32_t bitrate_bps) {
@ -838,11 +837,10 @@ void ModuleRtpRtcpImpl::SetGenericFECStatus(
rtp_sender_.SetGenericFECStatus(enable, payload_type_red, payload_type_fec);
}
void ModuleRtpRtcpImpl::GenericFECStatus(bool& enable,
uint8_t& payload_type_red,
uint8_t& payload_type_fec) {
rtp_sender_.GenericFECStatus(&enable, &payload_type_red,
&payload_type_fec);
void ModuleRtpRtcpImpl::GenericFECStatus(bool* enable,
uint8_t* payload_type_red,
uint8_t* payload_type_fec) {
rtp_sender_.GenericFECStatus(enable, payload_type_red, payload_type_fec);
}
int32_t ModuleRtpRtcpImpl::SetFecParameters(

View File

@ -260,7 +260,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
int32_t SetSendREDPayloadType(int8_t payload_type) override;
// Get payload type for Redundant Audio Data RFC 2198.
int32_t SendREDPayloadType(int8_t& payload_type) const override;
int32_t SendREDPayloadType(int8_t* payload_type) const override;
// Store the audio level in d_bov for header-extension-for-audio-level-
// indication.
@ -282,9 +282,9 @@ class ModuleRtpRtcpImpl : public RtpRtcp {
uint8_t payload_type_red,
uint8_t payload_type_fec) override;
void GenericFECStatus(bool& enable,
uint8_t& payload_type_red,
uint8_t& payload_type_fec) override;
void GenericFECStatus(bool* enable,
uint8_t* payload_type_red,
uint8_t* payload_type_fec) override;
int32_t SetFecParameters(const FecProtectionParams* delta_params,
const FecProtectionParams* key_params) override;

View File

@ -241,7 +241,7 @@ TEST_F(RtpRtcpAudioTest, RED) {
EXPECT_EQ(0, module1->SetSendREDPayloadType(voice_codec.pltype));
int8_t red = 0;
EXPECT_EQ(0, module1->SendREDPayloadType(red));
EXPECT_EQ(0, module1->SendREDPayloadType(&red));
EXPECT_EQ(voice_codec.pltype, red);
EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(
voice_codec.plname,
@ -278,7 +278,7 @@ TEST_F(RtpRtcpAudioTest, RED) {
&fragmentation));
EXPECT_EQ(0, module1->SetSendREDPayloadType(-1));
EXPECT_EQ(-1, module1->SendREDPayloadType(red));
EXPECT_EQ(-1, module1->SendREDPayloadType(&red));
}
TEST_F(RtpRtcpAudioTest, DTMF) {

View File

@ -263,8 +263,8 @@ void ViEChannel::UpdateHistograms() {
bool fec_enabled = false;
uint8_t pltype_red;
uint8_t pltype_fec;
rtp_rtcp_modules_[0]->GenericFECStatus(fec_enabled, pltype_red,
pltype_fec);
rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red,
&pltype_fec);
if (fec_enabled) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps",
static_cast<int>(rtp_rtx.fec.TotalBytes() *
@ -531,7 +531,7 @@ bool ViEChannel::IsSendingFecEnabled() {
uint8_t pltype_fec = 0;
for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
rtp_rtcp->GenericFECStatus(fec_enabled, pltype_red, pltype_fec);
rtp_rtcp->GenericFECStatus(&fec_enabled, &pltype_red, &pltype_fec);
if (fec_enabled)
return true;
}

View File

@ -3269,9 +3269,8 @@ Channel::GetREDStatus(bool& enabled, int& redPayloadtype)
enabled = audio_coding_->REDStatus();
if (enabled)
{
int8_t payloadType(0);
if (_rtpRtcpModule->SendREDPayloadType(payloadType) != 0)
{
int8_t payloadType = 0;
if (_rtpRtcpModule->SendREDPayloadType(&payloadType) != 0) {
_engineStatisticsPtr->SetLastError(
VE_RTP_RTCP_MODULE_ERROR, kTraceError,
"GetREDStatus() failed to retrieve RED PT from RTP/RTCP "