Enable padding bit in TransportFeedback packets
Set padding bit if the TransportFeedback packet contains zero padding. Also write number of padding elements at the last position of the packet. Bug: webrtc:10263 Change-Id: I8d17bc0e889f658ac383dec64ddcb95d438c9702 Reviewed-on: https://webrtc-review.googlesource.com/c/122240 Reviewed-by: Erik Språng <sprang@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Commit-Queue: Johannes Kron <kron@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26646}
This commit is contained in:
committed by
Commit Bot
parent
2ce0cb0e00
commit
99b9149cee
@ -52,7 +52,8 @@ bool RtcpPacket::OnBufferFull(uint8_t* packet,
|
||||
size_t RtcpPacket::HeaderLength() const {
|
||||
size_t length_in_bytes = BlockLength();
|
||||
RTC_DCHECK_GT(length_in_bytes, 0);
|
||||
RTC_DCHECK_EQ(length_in_bytes % 4, 0) << "Padding not supported";
|
||||
RTC_DCHECK_EQ(length_in_bytes % 4, 0)
|
||||
<< "Padding must be handled by each subclass.";
|
||||
// Length in 32-bit words without common header.
|
||||
return (length_in_bytes - kHeaderLength) / 4;
|
||||
}
|
||||
@ -71,12 +72,23 @@ void RtcpPacket::CreateHeader(
|
||||
size_t length,
|
||||
uint8_t* buffer,
|
||||
size_t* pos) {
|
||||
CreateHeader(count_or_format, packet_type, length, /*padding=*/false, buffer,
|
||||
pos);
|
||||
}
|
||||
|
||||
void RtcpPacket::CreateHeader(
|
||||
size_t count_or_format, // Depends on packet type.
|
||||
uint8_t packet_type,
|
||||
size_t length,
|
||||
bool padding,
|
||||
uint8_t* buffer,
|
||||
size_t* pos) {
|
||||
RTC_DCHECK_LE(length, 0xffffU);
|
||||
RTC_DCHECK_LE(count_or_format, 0x1f);
|
||||
constexpr uint8_t kVersionBits = 2 << 6;
|
||||
constexpr uint8_t kNoPaddingBit = 0 << 5;
|
||||
uint8_t padding_bit = padding ? 1 << 5 : 0;
|
||||
buffer[*pos + 0] =
|
||||
kVersionBits | kNoPaddingBit | static_cast<uint8_t>(count_or_format);
|
||||
kVersionBits | padding_bit | static_cast<uint8_t>(count_or_format);
|
||||
buffer[*pos + 1] = packet_type;
|
||||
buffer[*pos + 2] = (length >> 8) & 0xff;
|
||||
buffer[*pos + 3] = length & 0xff;
|
||||
|
||||
Reference in New Issue
Block a user