提交 bc6c6267 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Fix RtpPacket new header extension setters

上级 e7475e8d
...@@ -277,16 +277,13 @@ namespace RTC ...@@ -277,16 +277,13 @@ namespace RTC
{ {
// If already set, return true. // If already set, return true.
if (HasOneByteExtensions()) if (HasOneByteExtensions())
{
return true; return true;
}
// If it has Two-Bytes extensions, return false. // If it has Two-Bytes extensions, return false.
else if (HasTwoBytesExtensions()) else if (HasTwoBytesExtensions())
{
return false; return false;
} // If it has a different header extension, return false.
else if (this->headerExtension)
MS_ERROR("---------- YES 1 !!!"); return false;
// Set the header extension bit. // Set the header extension bit.
this->header->extension = 1u; this->header->extension = 1u;
...@@ -312,16 +309,13 @@ namespace RTC ...@@ -312,16 +309,13 @@ namespace RTC
{ {
// If already set, return true. // If already set, return true.
if (HasTwoBytesExtensions()) if (HasTwoBytesExtensions())
{
return true; return true;
}
// If it has One-Byte extensions, return false. // If it has One-Byte extensions, return false.
else if (HasOneByteExtensions()) else if (HasOneByteExtensions())
{
return false; return false;
} // If it has a different header extension, return false.
else if (this->headerExtension)
MS_ERROR("---------- YES 2 !!!"); return false;
// Set the header extension bit. // Set the header extension bit.
this->header->extension = 1u; this->header->extension = 1u;
...@@ -444,39 +438,20 @@ namespace RTC ...@@ -444,39 +438,20 @@ namespace RTC
if (this->payloadLength != 0) if (this->payloadLength != 0)
{ {
MS_ERROR("----- OH!! this->payloadLength != 0");
numBytes = this->payloadLength; numBytes = this->payloadLength;
std::memcpy(ptr, this->payload, numBytes); std::memcpy(ptr, this->payload, numBytes);
// Update pointer. // Update pointer.
ptr += numBytes; ptr += numBytes;
} }
else
{
MS_ERROR("----- OH!! this->payloadLength == 0");
}
// Copy payload padding. // Copy payload padding.
if (this->payloadPadding != 0u) if (this->payloadPadding != 0u)
{ {
MS_ERROR("----- OH!! this->payloadPadding:%" PRIu8, this->payloadPadding);
*(ptr + static_cast<size_t>(this->payloadPadding) - 1) = this->payloadPadding; *(ptr + static_cast<size_t>(this->payloadPadding) - 1) = this->payloadPadding;
ptr += size_t{ this->payloadPadding }; ptr += size_t{ this->payloadPadding };
} }
else
{
MS_ERROR("----- OH!! this->payloadPadding == 0");
}
if (static_cast<size_t>(ptr - buffer) != this->size)
{
MS_ERROR(
"----- OH!! (ptr - buffer):%zu, this->size:%zu, this->headerExtension->length:%" PRIu16 ", GetHeaderExtensionLength():%zu",
static_cast<size_t>(ptr - buffer), this->size, this->headerExtension->length, GetHeaderExtensionLength());
}
MS_ASSERT(static_cast<size_t>(ptr - buffer) == this->size, "ptr - buffer == this->size"); MS_ASSERT(static_cast<size_t>(ptr - buffer) == this->size, "ptr - buffer == this->size");
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论