Move rtcp packet classes from rtp_rtcp to rtp_rtcp_format target
Bug: None
Change-Id: I353228fd5b75bd4fceeaee1bb6fd07b01dac56a1
Reviewed-on: https://webrtc-review.googlesource.com/1480
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#19867}
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index 811dca6..79e3fb4 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -14,6 +14,58 @@
"include/rtp_header_extension_map.h",
"include/rtp_rtcp_defines.h",
"source/byte_io.h",
+ "source/rtcp_packet.cc",
+ "source/rtcp_packet.h",
+ "source/rtcp_packet/app.cc",
+ "source/rtcp_packet/app.h",
+ "source/rtcp_packet/bye.cc",
+ "source/rtcp_packet/bye.h",
+ "source/rtcp_packet/common_header.cc",
+ "source/rtcp_packet/common_header.h",
+ "source/rtcp_packet/compound_packet.cc",
+ "source/rtcp_packet/compound_packet.h",
+ "source/rtcp_packet/dlrr.cc",
+ "source/rtcp_packet/dlrr.h",
+ "source/rtcp_packet/extended_jitter_report.cc",
+ "source/rtcp_packet/extended_jitter_report.h",
+ "source/rtcp_packet/extended_reports.cc",
+ "source/rtcp_packet/extended_reports.h",
+ "source/rtcp_packet/fir.cc",
+ "source/rtcp_packet/fir.h",
+ "source/rtcp_packet/nack.cc",
+ "source/rtcp_packet/nack.h",
+ "source/rtcp_packet/pli.cc",
+ "source/rtcp_packet/pli.h",
+ "source/rtcp_packet/psfb.cc",
+ "source/rtcp_packet/psfb.h",
+ "source/rtcp_packet/rapid_resync_request.cc",
+ "source/rtcp_packet/rapid_resync_request.h",
+ "source/rtcp_packet/receiver_report.cc",
+ "source/rtcp_packet/receiver_report.h",
+ "source/rtcp_packet/remb.cc",
+ "source/rtcp_packet/remb.h",
+ "source/rtcp_packet/report_block.cc",
+ "source/rtcp_packet/report_block.h",
+ "source/rtcp_packet/rrtr.cc",
+ "source/rtcp_packet/rrtr.h",
+ "source/rtcp_packet/rtpfb.cc",
+ "source/rtcp_packet/rtpfb.h",
+ "source/rtcp_packet/sdes.cc",
+ "source/rtcp_packet/sdes.h",
+ "source/rtcp_packet/sender_report.cc",
+ "source/rtcp_packet/sender_report.h",
+ "source/rtcp_packet/target_bitrate.cc",
+ "source/rtcp_packet/target_bitrate.h",
+ "source/rtcp_packet/tmmb_item.cc",
+ "source/rtcp_packet/tmmb_item.h",
+ "source/rtcp_packet/tmmbn.cc",
+ "source/rtcp_packet/tmmbn.h",
+ "source/rtcp_packet/tmmbr.cc",
+ "source/rtcp_packet/tmmbr.h",
+ "source/rtcp_packet/transport_feedback.cc",
+ "source/rtcp_packet/transport_feedback.h",
+ "source/rtcp_packet/voip_metric.cc",
+ "source/rtcp_packet/voip_metric.h",
"source/rtp_header_extension_map.cc",
"source/rtp_header_extensions.cc",
"source/rtp_header_extensions.h",
@@ -68,58 +120,6 @@
"source/remote_ntp_time_estimator.cc",
"source/rtcp_nack_stats.cc",
"source/rtcp_nack_stats.h",
- "source/rtcp_packet.cc",
- "source/rtcp_packet.h",
- "source/rtcp_packet/app.cc",
- "source/rtcp_packet/app.h",
- "source/rtcp_packet/bye.cc",
- "source/rtcp_packet/bye.h",
- "source/rtcp_packet/common_header.cc",
- "source/rtcp_packet/common_header.h",
- "source/rtcp_packet/compound_packet.cc",
- "source/rtcp_packet/compound_packet.h",
- "source/rtcp_packet/dlrr.cc",
- "source/rtcp_packet/dlrr.h",
- "source/rtcp_packet/extended_jitter_report.cc",
- "source/rtcp_packet/extended_jitter_report.h",
- "source/rtcp_packet/extended_reports.cc",
- "source/rtcp_packet/extended_reports.h",
- "source/rtcp_packet/fir.cc",
- "source/rtcp_packet/fir.h",
- "source/rtcp_packet/nack.cc",
- "source/rtcp_packet/nack.h",
- "source/rtcp_packet/pli.cc",
- "source/rtcp_packet/pli.h",
- "source/rtcp_packet/psfb.cc",
- "source/rtcp_packet/psfb.h",
- "source/rtcp_packet/rapid_resync_request.cc",
- "source/rtcp_packet/rapid_resync_request.h",
- "source/rtcp_packet/receiver_report.cc",
- "source/rtcp_packet/receiver_report.h",
- "source/rtcp_packet/remb.cc",
- "source/rtcp_packet/remb.h",
- "source/rtcp_packet/report_block.cc",
- "source/rtcp_packet/report_block.h",
- "source/rtcp_packet/rrtr.cc",
- "source/rtcp_packet/rrtr.h",
- "source/rtcp_packet/rtpfb.cc",
- "source/rtcp_packet/rtpfb.h",
- "source/rtcp_packet/sdes.cc",
- "source/rtcp_packet/sdes.h",
- "source/rtcp_packet/sender_report.cc",
- "source/rtcp_packet/sender_report.h",
- "source/rtcp_packet/target_bitrate.cc",
- "source/rtcp_packet/target_bitrate.h",
- "source/rtcp_packet/tmmb_item.cc",
- "source/rtcp_packet/tmmb_item.h",
- "source/rtcp_packet/tmmbn.cc",
- "source/rtcp_packet/tmmbn.h",
- "source/rtcp_packet/tmmbr.cc",
- "source/rtcp_packet/tmmbr.h",
- "source/rtcp_packet/transport_feedback.cc",
- "source/rtcp_packet/transport_feedback.h",
- "source/rtcp_packet/voip_metric.cc",
- "source/rtcp_packet/voip_metric.h",
"source/rtcp_receiver.cc",
"source/rtcp_receiver.h",
"source/rtcp_sender.cc",
diff --git a/modules/rtp_rtcp/source/rtcp_packet.cc b/modules/rtp_rtcp/source/rtcp_packet.cc
index ef02b86..4c67f60 100644
--- a/modules/rtp_rtcp/source/rtcp_packet.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet.cc
@@ -65,7 +65,7 @@
// |V=2|P| RC/FMT | PT | length |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
void RtcpPacket::CreateHeader(
- uint8_t count_or_format, // Depends on packet type.
+ size_t count_or_format, // Depends on packet type.
uint8_t packet_type,
size_t length,
uint8_t* buffer,
@@ -74,7 +74,8 @@
RTC_DCHECK_LE(count_or_format, 0x1f);
constexpr uint8_t kVersionBits = 2 << 6;
constexpr uint8_t kNoPaddingBit = 0 << 5;
- buffer[*pos + 0] = kVersionBits | kNoPaddingBit | count_or_format;
+ buffer[*pos + 0] = kVersionBits | kNoPaddingBit |
+ static_cast<uint8_t>(count_or_format);
buffer[*pos + 1] = packet_type;
buffer[*pos + 2] = (length >> 8) & 0xff;
buffer[*pos + 3] = length & 0xff;
diff --git a/modules/rtp_rtcp/source/rtcp_packet.h b/modules/rtp_rtcp/source/rtcp_packet.h
index 5f7304e..248f47c 100644
--- a/modules/rtp_rtcp/source/rtcp_packet.h
+++ b/modules/rtp_rtcp/source/rtcp_packet.h
@@ -86,7 +86,7 @@
static constexpr size_t kHeaderLength = 4;
RtcpPacket() {}
- static void CreateHeader(uint8_t count_or_format,
+ static void CreateHeader(size_t count_or_format,
uint8_t packet_type,
size_t block_length, // Payload size in 32bit words.
uint8_t* buffer,
diff --git a/modules/rtp_rtcp/source/rtcp_packet/bye.cc b/modules/rtp_rtcp/source/rtcp_packet/bye.cc
index 2f85dd8..6cfda83 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/bye.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/bye.cc
@@ -97,7 +97,7 @@
}
// Store the reason to leave.
if (!reason_.empty()) {
- uint8_t reason_length = reason_.size();
+ uint8_t reason_length = static_cast<uint8_t>(reason_.size());
packet[(*index)++] = reason_length;
memcpy(&packet[*index], reason_.data(), reason_length);
*index += reason_length;
diff --git a/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc b/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc
index 5e3546b..d0d7b99 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/dlrr.cc
@@ -13,6 +13,7 @@
#include "modules/rtp_rtcp/source/byte_io.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "rtc_base/safe_conversions.h"
namespace webrtc {
namespace rtcp {
@@ -75,7 +76,8 @@
const uint8_t kReserved = 0;
buffer[0] = kBlockType;
buffer[1] = kReserved;
- ByteWriter<uint16_t>::WriteBigEndian(&buffer[2], 3 * sub_blocks_.size());
+ ByteWriter<uint16_t>::WriteBigEndian(
+ &buffer[2], rtc::dchecked_cast<uint16_t>(3 * sub_blocks_.size()));
// Create sub blocks.
uint8_t* write_at = buffer + kBlockHeaderLength;
for (const ReceiveTimeInfo& sub_block : sub_blocks_) {
diff --git a/modules/rtp_rtcp/source/rtcp_packet/remb.cc b/modules/rtp_rtcp/source/rtcp_packet/remb.cc
index 8cc281c..e599a0b 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/remb.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/remb.cc
@@ -125,7 +125,7 @@
mantissa >>= 1;
++exponenta;
}
- packet[(*index)++] = ssrcs_.size();
+ packet[(*index)++] = static_cast<uint8_t>(ssrcs_.size());
packet[(*index)++] = (exponenta << 2) | (mantissa >> 16);
ByteWriter<uint16_t>::WriteBigEndian(packet + *index, mantissa & 0xffff);
*index += sizeof(uint16_t);
diff --git a/modules/rtp_rtcp/source/rtcp_packet/sdes.cc b/modules/rtp_rtcp/source/rtcp_packet/sdes.cc
index 34f5186..50fc392 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/sdes.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/sdes.cc
@@ -173,8 +173,8 @@
for (const Sdes::Chunk& chunk : chunks_) {
ByteWriter<uint32_t>::WriteBigEndian(&packet[*index + 0], chunk.ssrc);
ByteWriter<uint8_t>::WriteBigEndian(&packet[*index + 4], kCnameTag);
- ByteWriter<uint8_t>::WriteBigEndian(&packet[*index + 5],
- chunk.cname.size());
+ ByteWriter<uint8_t>::WriteBigEndian(
+ &packet[*index + 5], static_cast<uint8_t>(chunk.cname.size()));
memcpy(&packet[*index + 6], chunk.cname.data(), chunk.cname.size());
*index += (6 + chunk.cname.size());
diff --git a/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.cc b/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.cc
index ffcc3d0..5afab54 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.cc
@@ -12,6 +12,7 @@
#include "modules/rtp_rtcp/source/byte_io.h"
#include "rtc_base/checks.h"
+#include "rtc_base/safe_conversions.h"
namespace webrtc {
namespace rtcp {
@@ -61,8 +62,10 @@
// If VP9 SVC is used, there will be only one SSRC, so each spatial and
// temporal layer combo used shall be specified in the TargetBitrate packet.
-TargetBitrate::TargetBitrate() {}
-TargetBitrate::~TargetBitrate() {}
+TargetBitrate::TargetBitrate() = default;
+TargetBitrate::TargetBitrate(const TargetBitrate&) = default;
+TargetBitrate& TargetBitrate::operator=(const TargetBitrate&) = default;
+TargetBitrate::~TargetBitrate() = default;
void TargetBitrate::Parse(const uint8_t* block, uint16_t block_length) {
// Validate block header (should already have been parsed and checked).
@@ -107,7 +110,8 @@
void TargetBitrate::Create(uint8_t* buffer) const {
buffer[0] = kBlockType;
buffer[1] = 0; // Reserved.
- const size_t block_length_words = (BlockLength() / 4) - 1;
+ uint16_t block_length_words =
+ rtc::dchecked_cast<uint16_t>((BlockLength() / 4) - 1);
ByteWriter<uint16_t>::WriteBigEndian(&buffer[2], block_length_words);
size_t index = kTargetBitrateHeaderSizeBytes;
diff --git a/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h b/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h
index 6ac0fa4..a3793e3 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h
+++ b/modules/rtp_rtcp/source/rtcp_packet/target_bitrate.h
@@ -37,6 +37,8 @@
};
TargetBitrate();
+ TargetBitrate(const TargetBitrate&);
+ TargetBitrate& operator=(const TargetBitrate&);
~TargetBitrate();
void AddTargetBitrate(uint8_t spatial_layer,
diff --git a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
index 548b495..676b7df 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.cc
@@ -38,7 +38,7 @@
// * 8 bytes FeedbackPacket header.
// * 2 bytes for one chunk.
constexpr size_t kMinPayloadSizeBytes = 8 + 8 + 2;
-constexpr size_t kBaseScaleFactor =
+constexpr int kBaseScaleFactor =
TransportFeedback::kDeltaScaleFactor * (1 << 8);
constexpr int64_t kTimeWrapPeriodUs = (1ll << 24) * kBaseScaleFactor;
@@ -116,7 +116,7 @@
void DecodeRunLength(uint16_t chunk, size_t max_size);
DeltaSize delta_sizes_[kMaxVectorCapacity];
- uint16_t size_;
+ size_t size_;
bool all_same_;
bool has_large_delta_;
};
@@ -291,14 +291,14 @@
uint16_t TransportFeedback::LastChunk::EncodeRunLength() const {
RTC_DCHECK(all_same_);
RTC_DCHECK_LE(size_, kMaxRunLengthCapacity);
- return (delta_sizes_[0] << 13) | size_;
+ return (delta_sizes_[0] << 13) | static_cast<uint16_t>(size_);
}
void TransportFeedback::LastChunk::DecodeRunLength(uint16_t chunk,
size_t max_count) {
RTC_DCHECK_EQ(chunk & 0x8000, 0);
size_ = std::min<size_t>(chunk & 0x1fff, max_count);
- size_t delta_size = (chunk >> 13) & 0x03;
+ DeltaSize delta_size = (chunk >> 13) & 0x03;
has_large_delta_ = delta_size >= kLarge;
all_same_ = true;
// To make it consistent with Add function, populate delta_sizes_ beyound 1st.
@@ -398,7 +398,7 @@
ParseCommonFeedback(payload);
base_seq_no_ = ByteReader<uint16_t>::ReadBigEndian(&payload[8]);
- size_t status_count = ByteReader<uint16_t>::ReadBigEndian(&payload[10]);
+ uint16_t status_count = ByteReader<uint16_t>::ReadBigEndian(&payload[10]);
base_time_ticks_ = ByteReader<int32_t, 3>::ReadBigEndian(&payload[12]);
feedback_seq_ = payload[15];
Clear();