diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc index 610dfe36ff..cdb45b0d5f 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.cc @@ -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. diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h index c1db9e8d4d..744423ed70 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h @@ -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 {} diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.cc index 7fdcc1633a..7838fccf82 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.cc @@ -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"; diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h index 64caf1b5c4..2ed6cd73b4 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/pli.h @@ -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 {} diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc index 808190ad10..93da4dcd1b 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.cc @@ -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(); diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h index 2bfe174c50..c900d9c8c7 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h @@ -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. diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc index 9c44547aed..b0a5e781a3 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.cc @@ -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 chunks; // Read chunk into temporary array, so that in diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h index d9a9526733..3e5abfea15 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h @@ -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; diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc index 5e3a6cdff0..312b3f96d1 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.cc @@ -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() < diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h index 91a66b7e8a..4064595df3 100644 --- a/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h +++ b/webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h @@ -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 {}