Replace const -> constexpr for rtcp Packet Type

for consistency with other rtcp packet classes.

BUG=webrtc:5260

Review-Url: https://codereview.webrtc.org/2361853002
Cr-Commit-Position: refs/heads/master@{#14648}
This commit is contained in:
danilchap 2016-10-17 02:07:54 -07:00 committed by Commit bot
parent c1f40b7bae
commit 2f255d8d67
10 changed files with 16 additions and 15 deletions

View File

@ -19,7 +19,7 @@
namespace webrtc {
namespace rtcp {
constexpr uint8_t Bye::kPacketType;
// Bye packet (BYE) (RFC 3550).
//
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -35,7 +35,7 @@ namespace rtcp {
Bye::Bye() : sender_ssrc_(0) {}
bool Bye::Parse(const CommonHeader& packet) {
RTC_DCHECK(packet.type() == kPacketType);
RTC_DCHECK_EQ(packet.type(), kPacketType);
const uint8_t src_count = packet.count();
// Validate packet.

View File

@ -24,7 +24,7 @@ class CommonHeader;
class Bye : public RtcpPacket {
public:
static const uint8_t kPacketType = 203;
static constexpr uint8_t kPacketType = 203;
Bye();
~Bye() override {}

View File

@ -16,7 +16,7 @@
namespace webrtc {
namespace rtcp {
constexpr uint8_t Pli::kFeedbackMessageType;
// RFC 4585: Feedback format.
//
// Common packet format:
@ -37,8 +37,8 @@ namespace rtcp {
// Picture loss indication (PLI) (RFC 4585).
// FCI: no feedback control information.
bool Pli::Parse(const CommonHeader& packet) {
RTC_DCHECK(packet.type() == kPacketType);
RTC_DCHECK(packet.fmt() == kFeedbackMessageType);
RTC_DCHECK_EQ(packet.type(), kPacketType);
RTC_DCHECK_EQ(packet.fmt(), kFeedbackMessageType);
if (packet.payload_size_bytes() < kCommonFeedbackLength) {
LOG(LS_WARNING) << "Packet is too small to be a valid PLI packet";

View File

@ -20,7 +20,7 @@ class CommonHeader;
// Picture loss indication (PLI) (RFC 4585).
class Pli : public Psfb {
public:
static const uint8_t kFeedbackMessageType = 1;
static constexpr uint8_t kFeedbackMessageType = 1;
Pli() {}
~Pli() override {}

View File

@ -17,7 +17,7 @@
namespace webrtc {
namespace rtcp {
//
constexpr uint8_t ReceiverReport::kPacketType;
// RTCP receiver report (RFC 3550).
//
// 0 1 2 3
@ -30,7 +30,7 @@ namespace rtcp {
// | report block(s) |
// | .... |
bool ReceiverReport::Parse(const CommonHeader& packet) {
RTC_DCHECK(packet.type() == kPacketType);
RTC_DCHECK_EQ(packet.type(), kPacketType);
const uint8_t report_blocks_count = packet.count();

View File

@ -24,9 +24,8 @@ class CommonHeader;
class ReceiverReport : public RtcpPacket {
public:
static const uint8_t kPacketType = 201;
static constexpr uint8_t kPacketType = 201;
ReceiverReport() : sender_ssrc_(0) {}
~ReceiverReport() override {}
// Parse assumes header is already parsed and validated.

View File

@ -19,6 +19,7 @@
namespace webrtc {
namespace rtcp {
constexpr uint8_t Sdes::kPacketType;
// Source Description (SDES) (RFC 3550).
//
// 0 1 2 3
@ -62,7 +63,7 @@ Sdes::Sdes() : block_length_(RtcpPacket::kHeaderLength) {}
Sdes::~Sdes() {}
bool Sdes::Parse(const CommonHeader& packet) {
RTC_DCHECK(packet.type() == kPacketType);
RTC_DCHECK_EQ(packet.type(), kPacketType);
uint8_t number_of_chunks = packet.count();
std::vector<Chunk> chunks; // Read chunk into temporary array, so that in

View File

@ -28,7 +28,7 @@ class Sdes : public RtcpPacket {
uint32_t ssrc;
std::string cname;
};
static const uint8_t kPacketType = 202;
static constexpr uint8_t kPacketType = 202;
Sdes();
~Sdes() override;

View File

@ -17,6 +17,7 @@
namespace webrtc {
namespace rtcp {
constexpr uint8_t SenderReport::kPacketType;
// Sender report (SR) (RFC 3550).
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -43,7 +44,7 @@ SenderReport::SenderReport()
sender_octet_count_(0) {}
bool SenderReport::Parse(const CommonHeader& packet) {
RTC_DCHECK(packet.type() == kPacketType);
RTC_DCHECK_EQ(packet.type(), kPacketType);
const uint8_t report_block_count = packet.count();
if (packet.payload_size_bytes() <

View File

@ -24,7 +24,7 @@ class CommonHeader;
class SenderReport : public RtcpPacket {
public:
static const uint8_t kPacketType = 200;
static constexpr uint8_t kPacketType = 200;
SenderReport();
~SenderReport() override {}