Unverified 提交 6697804f authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

Fix RTCP SDES (#1139)

上级 df1f224e
# Changelog # Changelog
### Next
* Fix RTCP SDES ([PR #1139](https://github.com/versatica/mediasoup/pull/1139)).
### 3.12.8 ### 3.12.8
* Export `workerBin` absolute path ([PR #1123](https://github.com/versatica/mediasoup/pull/1123)). * Export `workerBin` absolute path ([PR #1123](https://github.com/versatica/mediasoup/pull/1123)).
......
...@@ -12,7 +12,7 @@ RUN \ ...@@ -12,7 +12,7 @@ RUN \
clang clang
# Install node 16. # Install node 16.
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs RUN apt-get install -y nodejs
# Make CC and CXX point to clang/clang++ installed above. # Make CC and CXX point to clang/clang++ installed above.
......
...@@ -121,6 +121,9 @@ namespace RTC ...@@ -121,6 +121,9 @@ namespace RTC
size += item->GetSize(); size += item->GetSize();
} }
// Add the mandatory null octet.
++size;
// Consider pading to 32 bits (4 bytes) boundary. // Consider pading to 32 bits (4 bytes) boundary.
// http://stackoverflow.com/questions/11642210/computing-padding-required-for-n-byte-alignment // http://stackoverflow.com/questions/11642210/computing-padding-required-for-n-byte-alignment
return (size + 3) & ~3; return (size + 3) & ~3;
......
...@@ -36,17 +36,21 @@ namespace RTC ...@@ -36,17 +36,21 @@ namespace RTC
// Get the header. // Get the header.
auto* header = const_cast<Header*>(reinterpret_cast<const Header*>(data)); auto* header = const_cast<Header*>(reinterpret_cast<const Header*>(data));
// If item type is 0, there is no need for length field (unless padding
// is needed).
if (len > 0 && header->type == SdesItem::Type::END)
{
return nullptr;
}
// data size must be >= header + length value. // data size must be >= header + length value.
if (len < HeaderSize || len < (1u * 2) + header->length) if (len < HeaderSize || len < HeaderSize + header->length)
{ {
MS_WARN_TAG(rtcp, "not enough space for SDES item, discarded"); MS_WARN_TAG(rtcp, "not enough space for SDES item, discarded");
return nullptr; return nullptr;
} }
if (header->type == SdesItem::Type::END)
return nullptr;
return new SdesItem(header); return new SdesItem(header);
} }
...@@ -57,7 +61,9 @@ namespace RTC ...@@ -57,7 +61,9 @@ namespace RTC
auto it = SdesItem::type2String.find(type); auto it = SdesItem::type2String.find(type);
if (it == SdesItem::type2String.end()) if (it == SdesItem::type2String.end())
{
return Unknown; return Unknown;
}
return it->second; return it->second;
} }
...@@ -123,19 +129,77 @@ namespace RTC ...@@ -123,19 +129,77 @@ namespace RTC
std::unique_ptr<SdesChunk> chunk(new SdesChunk(ssrc)); std::unique_ptr<SdesChunk> chunk(new SdesChunk(ssrc));
size_t offset = 4u /* ssrc */; size_t offset{ 4u }; /* ssrc */
size_t chunkLength{ 4u };
while (len > offset) while (len > offset)
{ {
SdesItem* item = SdesItem::Parse(data + offset, len - offset); auto* item = SdesItem::Parse(data + offset, len - offset);
if (!item) if (!item)
{
break; break;
}
chunk->AddItem(item); chunk->AddItem(item);
chunkLength += item->GetSize();
offset += item->GetSize(); offset += item->GetSize();
} }
// Once all items have been parsed, there must be 1, 2, 3 or 4 null octets
// (this is mandatory). The first one (AKA item type 0) means "end of
// items", and the others maybe needed for padding the chunk to 4 bytes.
// First ensure that there is at least one null octet.
if (offset == len || (offset < len && Utils::Byte::Get1Byte(data, offset) != 0u))
{
MS_WARN_TAG(rtcp, "invalid SDES chunk (missing mandatory null octet), discarded");
return nullptr;
}
// So we have the mandatory null octet.
++chunkLength;
++offset;
// Then check that there are 0, 1, 2 or 3 (no more) null octets that pad
// the chunk to 4 bytes.
uint16_t neededAdditionalNullOctets =
Utils::Byte::PadTo4Bytes(static_cast<uint16_t>(chunkLength)) -
static_cast<uint16_t>(chunkLength);
uint16_t foundAdditionalNullOctets{ 0u };
for (uint16_t i{ 0u }; len > offset && i < neededAdditionalNullOctets; ++i)
{
if (Utils::Byte::Get1Byte(data, offset) != 0u)
{
MS_WARN_TAG(
rtcp,
"invalid SDES chunk (missing additional null octets [needed:%" PRIu16 ", found:%" PRIu16
"]), discarded",
neededAdditionalNullOctets,
foundAdditionalNullOctets);
return nullptr;
}
++foundAdditionalNullOctets;
++chunkLength;
++offset;
}
if (foundAdditionalNullOctets != neededAdditionalNullOctets)
{
MS_WARN_TAG(
rtcp,
"invalid SDES chunk (missing additional null octets [needed:%" PRIu16 ", found:%" PRIu16
"]), discarded",
neededAdditionalNullOctets,
foundAdditionalNullOctets);
return nullptr;
}
return chunk.release(); return chunk.release();
} }
...@@ -155,10 +219,15 @@ namespace RTC ...@@ -155,10 +219,15 @@ namespace RTC
offset += item->Serialize(buffer + offset); offset += item->Serialize(buffer + offset);
} }
// Add the mandatory null octet.
buffer[offset] = 0;
++offset;
// 32 bits padding. // 32 bits padding.
const size_t padding = (-offset) & 3; const size_t padding = (-offset) & 3;
for (size_t i{ 0 }; i < padding; ++i) for (size_t i{ 0u }; i < padding; ++i)
{ {
buffer[offset + i] = 0; buffer[offset + i] = 0;
} }
...@@ -195,9 +264,9 @@ namespace RTC ...@@ -195,9 +264,9 @@ namespace RTC
size_t offset = Packet::CommonHeaderSize; size_t offset = Packet::CommonHeaderSize;
uint8_t count = header->count; uint8_t count = header->count;
while ((count-- != 0u) && (len > offset)) while (count-- && (len > offset))
{ {
SdesChunk* chunk = SdesChunk::Parse(data + offset, len - offset); auto* chunk = SdesChunk::Parse(data + offset, len - offset);
if (chunk != nullptr) if (chunk != nullptr)
{ {
...@@ -206,10 +275,17 @@ namespace RTC ...@@ -206,10 +275,17 @@ namespace RTC
} }
else else
{ {
return packet.release(); break;
} }
} }
if (packet->GetCount() != header->count)
{
MS_WARN_TAG(rtcp, "RTCP count value doesn't match found number of chunks, discarded");
return nullptr;
}
return packet.release(); return packet.release();
} }
...@@ -223,7 +299,7 @@ namespace RTC ...@@ -223,7 +299,7 @@ namespace RTC
size_t length = 0; size_t length = 0;
uint8_t* header = { nullptr }; uint8_t* header = { nullptr };
for (size_t i = 0; i < this->GetCount(); i++) for (size_t i{ 0u }; i < this->GetCount(); ++i)
{ {
// Create a new SDES packet header for each 31 chunks. // Create a new SDES packet header for each 31 chunks.
if (i % MaxChunksPerPacket == 0) if (i % MaxChunksPerPacket == 0)
......
...@@ -11,68 +11,378 @@ namespace TestSdes ...@@ -11,68 +11,378 @@ namespace TestSdes
// RTCP Sdes Packet. // RTCP Sdes Packet.
// clang-format off // clang-format off
uint8_t buffer[] = uint8_t buffer1[] =
{ {
0x81, 0xca, 0x00, 0x06, // Type: 202 (SDES), Count: 1, Length: 6 0x81, 0xca, 0x00, 0x06, // Type: 202 (SDES), Count: 1, Length: 6
0x9f, 0x65, 0xe7, 0x42, // SSRC: 0x9f65e742 0x9f, 0x65, 0xe7, 0x42, // SSRC: 0x9f65e742
// Chunk 1
0x01, 0x10, 0x74, 0x37, // Item Type: 1 (CNAME), Length: 16, Value: t7mkYnCm46OcINy/ 0x01, 0x10, 0x74, 0x37, // Item Type: 1 (CNAME), Length: 16, Value: t7mkYnCm46OcINy/
0x6d, 0x6b, 0x59, 0x6e, 0x6d, 0x6b, 0x59, 0x6e,
0x43, 0x6d, 0x34, 0x36, 0x43, 0x6d, 0x34, 0x36,
0x4f, 0x63, 0x49, 0x4e, 0x4f, 0x63, 0x49, 0x4e,
0x79, 0x2f, 0x00, 0x00 0x79, 0x2f, 0x00, 0x00 // 2 null octets
}; };
// clang-format on // clang-format on
uint8_t* chunkBuffer = buffer + Packet::CommonHeaderSize; // First chunk (chunk 1).
uint32_t ssrc1{ 0x9f65e742 };
// First item (item 1).
SdesItem::Type item1Type{ SdesItem::Type::CNAME };
std::string item1Value{ "t7mkYnCm46OcINy/" };
size_t item1Length{ 16u };
// SDES values. // clang-format off
uint32_t ssrc{ 0x9f65e742 }; uint8_t buffer2[] =
SdesItem::Type type{ SdesItem::Type::CNAME };
std::string value{ "t7mkYnCm46OcINy/" };
size_t length = 16;
void verify(SdesChunk* chunk)
{ {
REQUIRE(chunk->GetSsrc() == ssrc); 0xa2, 0xca, 0x00, 0x0d, // Padding, Type: 202 (SDES), Count: 2, Length: 13
// Chunk 2
0x00, 0x00, 0x04, 0xd2, // SSRC: 1234
0x01, 0x06, 0x71, 0x77, // Item Type: 1 (CNAME), Length: 6, Text: "qwerty"
0x65, 0x72, 0x74, 0x79,
0x06, 0x06, 0x69, 0xc3, // Item Type: 6 (TOOL), Length: 6, Text: "iñaki"
0xb1, 0x61, 0x6b, 0x69,
0x00, 0x00, 0x00, 0x00, // 4 null octets
// Chunk 3
0x00, 0x00, 0x16, 0x2e, // SSRC: 5678
0x05, 0x11, 0x73, 0x6f, // Item Type: 5 (LOC), Length: 17, Text: "somewhere œæ€"
0x6d, 0x65, 0x77, 0x68,
0x65, 0x72, 0x65, 0x20,
0xc5, 0x93, 0xc3, 0xa6,
0xe2, 0x82, 0xac, 0x00, // 1 null octet
0x00, 0x00, 0x00, 0x00 // Pading (4 bytes)
};
// clang-format on
SdesItem* item = *(chunk->Begin()); // First chunk (chunk 2).
uint32_t ssrc2{ 1234 };
// First item (item 2).
SdesItem::Type item2Type{ SdesItem::Type::CNAME };
std::string item2Value{ "qwerty" };
size_t item2Length{ 6u };
// First item (item 3).
SdesItem::Type item3Type{ SdesItem::Type::TOOL };
std::string item3Value{ "iñaki" };
size_t item3Length{ 6u };
// Second chunk (chunk 3).
uint32_t ssrc3{ 5678 };
// First item (item 4).
SdesItem::Type item4Type{ SdesItem::Type::LOC };
std::string item4Value{ "somewhere œæ€" };
size_t item4Length{ 17u };
REQUIRE(item->GetType() == type); // clang-format off
REQUIRE(item->GetLength() == length); uint8_t buffer3[] =
REQUIRE(std::string(item->GetValue(), length) == value); {
} 0x81, 0xca, 0x00, 0x03, // Type: 202 (SDES), Count: 1, Length: 3
// Chunk
0x11, 0x22, 0x33, 0x44, // SSRC: 0x11223344
0x05, 0x02, 0x61, 0x62, // Item Type: 5 (LOC), Length: 2, Text: "ab"
0x00, 0x00, 0x00, 0x00 // 4 null octets
};
// clang-format on
// First chunk (chunk 4).
uint32_t ssrc4{ 0x11223344 };
// First item (item 5).
SdesItem::Type item5Type{ SdesItem::Type::LOC };
std::string item5Value{ "ab" };
size_t item5Length{ 2u };
} // namespace TestSdes } // namespace TestSdes
using namespace TestSdes; using namespace TestSdes;
SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]") SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
{ {
SECTION("parse packet") SECTION("parse packet 1")
{ {
SdesPacket* packet = SdesPacket::Parse(buffer, sizeof(buffer)); SdesPacket* packet = SdesPacket::Parse(buffer1, sizeof(buffer1));
SdesChunk* chunk = *(packet->Begin()); auto* header = reinterpret_cast<RTC::RTCP::Packet::CommonHeader*>(buffer1);
auto* header = reinterpret_cast<RTC::RTCP::Packet::CommonHeader*>(buffer);
REQUIRE(packet);
REQUIRE(ntohs(header->length) == 6); REQUIRE(ntohs(header->length) == 6);
REQUIRE(chunk); REQUIRE(packet->GetSize() == 28);
REQUIRE(packet->GetCount() == 1);
size_t chunkIdx{ 0u };
for (auto it = packet->Begin(); it != packet->End(); ++it, ++chunkIdx)
{
auto* chunk = *it;
switch (chunkIdx)
{
/* First chunk (chunk 1). */
case 0:
{
// Chunk size must be 24 bytes (including 4 null octets).
REQUIRE(chunk->GetSize() == 24);
REQUIRE(chunk->GetSsrc() == ssrc1);
size_t itemIdx{ 0u };
for (auto it2 = chunk->Begin(); it2 != chunk->End(); ++it2, ++itemIdx)
{
auto* item = *it2;
switch (itemIdx)
{
/* First item (item 1). */
case 0:
{
REQUIRE(item->GetType() == item1Type);
REQUIRE(item->GetLength() == item1Length);
REQUIRE(std::string(item->GetValue(), item1Length) == item1Value);
break;
}
}
}
// There is 1 item.
REQUIRE(itemIdx == 1);
break;
}
}
}
verify(chunk); // There is 1 chunk.
REQUIRE(chunkIdx == 1);
SECTION("serialize SdesChunk instance") SECTION("serialize SdesChunk instance")
{ {
uint8_t serialized[sizeof(buffer) - Packet::CommonHeaderSize] = { 0 }; auto it = packet->Begin();
auto* chunk1 = *it;
uint8_t* chunk1Buffer = buffer1 + Packet::CommonHeaderSize;
chunk->Serialize(serialized); // NOTE: Length of first chunk (including null octets) is 24.
uint8_t serialized1[24] = { 0 };
SECTION("compare serialized SdesChunk with original buffer") chunk1->Serialize(serialized1);
REQUIRE(std::memcmp(chunk1Buffer, serialized1, 24) == 0);
}
delete packet;
}
SECTION("parse packet 2")
{
SdesPacket* packet = SdesPacket::Parse(buffer2, sizeof(buffer2));
auto* header = reinterpret_cast<RTC::RTCP::Packet::CommonHeader*>(buffer2);
REQUIRE(packet);
REQUIRE(ntohs(header->length) == 13);
// Despite total buffer size is 56 bytes, our GetSize() method doesn't not
// consider RTCP padding (4 bytes in this case).
REQUIRE(packet->GetSize() == 52);
REQUIRE(packet->GetCount() == 2);
size_t chunkIdx{ 0u };
for (auto it = packet->Begin(); it != packet->End(); ++it, ++chunkIdx)
{
auto* chunk = *it;
switch (chunkIdx)
{ {
REQUIRE(std::memcmp(chunkBuffer, serialized, sizeof(buffer) - Packet::CommonHeaderSize) == 0); /* First chunk (chunk 2). */
case 0:
{
// Chunk size must be 24 bytes (including 4 null octets).
REQUIRE(chunk->GetSize() == 24);
REQUIRE(chunk->GetSsrc() == ssrc2);
size_t itemIdx{ 0u };
for (auto it2 = chunk->Begin(); it2 != chunk->End(); ++it2, ++itemIdx)
{
auto* item = *it2;
switch (itemIdx)
{
/* First item (item 2). */
case 0:
{
REQUIRE(item->GetType() == item2Type);
REQUIRE(item->GetLength() == item2Length);
REQUIRE(std::string(item->GetValue(), item2Length) == item2Value);
break;
}
/* Second item (item 3). */
case 1:
{
REQUIRE(item->GetType() == item3Type);
REQUIRE(item->GetLength() == item3Length);
REQUIRE(std::string(item->GetValue(), item3Length) == item3Value);
break;
}
}
}
// There are 2 items.
REQUIRE(itemIdx == 2);
break;
}
/* Second chunk (chunk 3). */
case 1:
{
// Chunk size must be 24 bytes (including 1 null octet).
REQUIRE(chunk->GetSize() == 24);
REQUIRE(chunk->GetSsrc() == ssrc3);
size_t itemIdx{ 0u };
for (auto it2 = chunk->Begin(); it2 != chunk->End(); ++it2, ++itemIdx)
{
auto* item = *it2;
switch (itemIdx)
{
/* First item (item 4). */
case 0:
{
REQUIRE(item->GetType() == item4Type);
REQUIRE(item->GetLength() == item4Length);
REQUIRE(std::string(item->GetValue(), item4Length) == item4Value);
break;
}
}
}
// There is 1 item.
REQUIRE(itemIdx == 1);
break;
}
} }
} }
// There are 2 chunks.
REQUIRE(chunkIdx == 2);
SECTION("serialize SdesChunk instances")
{
auto it = packet->Begin();
auto* chunk1 = *it;
uint8_t* chunk1Buffer = buffer2 + Packet::CommonHeaderSize;
// NOTE: Length of first chunk (including null octets) is 24.
uint8_t serialized1[24] = { 0 };
chunk1->Serialize(serialized1);
REQUIRE(std::memcmp(chunk1Buffer, serialized1, 24) == 0);
auto* chunk2 = *(++it);
uint8_t* chunk2Buffer = buffer2 + Packet::CommonHeaderSize + 24;
// NOTE: Length of second chunk (including null octets) is 24.
uint8_t serialized2[24] = { 0 };
chunk2->Serialize(serialized2);
REQUIRE(std::memcmp(chunk2Buffer, serialized2, 24) == 0);
}
delete packet;
}
SECTION("parse packet 3")
{
SdesPacket* packet = SdesPacket::Parse(buffer3, sizeof(buffer3));
auto* header = reinterpret_cast<RTC::RTCP::Packet::CommonHeader*>(buffer3);
REQUIRE(packet);
REQUIRE(ntohs(header->length) == 3);
REQUIRE(packet->GetSize() == 16);
REQUIRE(packet->GetCount() == 1);
size_t chunkIdx{ 0u };
for (auto it = packet->Begin(); it != packet->End(); ++it, ++chunkIdx)
{
auto* chunk = *it;
switch (chunkIdx)
{
/* First chunk (chunk 4). */
case 0:
{
REQUIRE(chunk->GetSize() == 12);
REQUIRE(chunk->GetSsrc() == ssrc4);
size_t itemIdx{ 0u };
for (auto it2 = chunk->Begin(); it2 != chunk->End(); ++it2, ++itemIdx)
{
auto* item = *it2;
switch (itemIdx)
{
/* First item (item 5). */
case 0:
{
REQUIRE(item->GetType() == item5Type);
REQUIRE(item->GetLength() == item5Length);
REQUIRE(std::string(item->GetValue(), item5Length) == item5Value);
break;
}
}
}
// There is 1 item.
REQUIRE(itemIdx == 1);
break;
}
}
}
// There is 1 chunk.
REQUIRE(chunkIdx == 1);
SECTION("serialize SdesChunk instance")
{
auto it = packet->Begin();
auto* chunk1 = *it;
uint8_t* chunk1Buffer = buffer3 + Packet::CommonHeaderSize;
// NOTE: Length of first chunk (including null octets) is 12.
uint8_t serialized1[12] = { 0 };
chunk1->Serialize(serialized1);
REQUIRE(std::memcmp(chunk1Buffer, serialized1, 12) == 0);
}
delete packet; delete packet;
} }
SECTION("parsing a packet with missing null octects fails")
{
// clang-format off
uint8_t buffer[] =
{
0x81, 0xca, 0x00, 0x02, // Type: 202 (SDES), Count: 1, Length: 2
// Chunk
0x11, 0x22, 0x33, 0x44, // SSRC: 0x11223344
0x08, 0x02, 0x61, 0x62 // Item Type: 8 (PRIV), Length: 2, Text: "ab"
};
SdesPacket* packet = SdesPacket::Parse(buffer, sizeof(buffer));
REQUIRE(!packet);
}
SECTION("create SDES packet with more than 31 chunks") SECTION("create SDES packet with more than 31 chunks")
{ {
const size_t count = 33; const size_t count = 33;
...@@ -82,23 +392,24 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]") ...@@ -82,23 +392,24 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
for (auto i = 1; i <= count; i++) for (auto i = 1; i <= count; i++)
{ {
// Create chunk and add to packet. // Create chunk and add to packet.
SdesChunk* chunk = new SdesChunk(i /*ssrc*/); SdesChunk* chunk1 = new SdesChunk(i /*ssrc*/);
auto* item = new RTC::RTCP::SdesItem(SdesItem::Type::CNAME, value.size(), value.c_str()); auto* item1 =
new RTC::RTCP::SdesItem(SdesItem::Type::CNAME, item1Value.size(), item1Value.c_str());
chunk->AddItem(item); chunk1->AddItem(item1);
packet.AddChunk(chunk); packet.AddChunk(chunk1);
} }
REQUIRE(packet.GetCount() == count); REQUIRE(packet.GetCount() == count);
uint8_t buffer[1500] = { 0 }; uint8_t buffer1[1500] = { 0 };
// Serialization must contain 2 RR packets since report count exceeds 31. // Serialization must contain 2 RR packets since report count exceeds 31.
packet.Serialize(buffer); packet.Serialize(buffer1);
auto* packet2 = static_cast<SdesPacket*>(Packet::Parse(buffer, sizeof(buffer))); auto* packet2 = static_cast<SdesPacket*>(Packet::Parse(buffer1, sizeof(buffer1)));
REQUIRE(packet2 != nullptr); REQUIRE(packet2 != nullptr);
REQUIRE(packet2->GetCount() == 31); REQUIRE(packet2->GetCount() == 31);
...@@ -114,8 +425,8 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]") ...@@ -114,8 +425,8 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
auto* item = *(chunk->Begin()); auto* item = *(chunk->Begin());
REQUIRE(item->GetType() == SdesItem::Type::CNAME); REQUIRE(item->GetType() == SdesItem::Type::CNAME);
REQUIRE(item->GetSize() == 2 + value.size()); REQUIRE(item->GetSize() == 2 + item1Value.size());
REQUIRE(std::string(item->GetValue()) == value); REQUIRE(std::string(item->GetValue()) == item1Value);
} }
SdesPacket* packet3 = static_cast<SdesPacket*>(packet2->GetNext()); SdesPacket* packet3 = static_cast<SdesPacket*>(packet2->GetNext());
...@@ -134,8 +445,8 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]") ...@@ -134,8 +445,8 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
auto* item = *(chunk->Begin()); auto* item = *(chunk->Begin());
REQUIRE(item->GetType() == SdesItem::Type::CNAME); REQUIRE(item->GetType() == SdesItem::Type::CNAME);
REQUIRE(item->GetSize() == 2 + value.size()); REQUIRE(item->GetSize() == 2 + item1Value.size());
REQUIRE(std::string(item->GetValue()) == value); REQUIRE(std::string(item->GetValue()) == item1Value);
} }
delete packet2; delete packet2;
...@@ -144,13 +455,19 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]") ...@@ -144,13 +455,19 @@ SCENARIO("RTCP SDES parsing", "[parser][rtcp][sdes]")
SECTION("create SdesChunk") SECTION("create SdesChunk")
{ {
auto* item = new SdesItem(type, length, value.c_str()); auto* item = new SdesItem(item1Type, item1Length, item1Value.c_str());
// Create sdes chunk. // Create sdes chunk.
SdesChunk chunk(ssrc); SdesChunk chunk(ssrc1);
chunk.AddItem(item); chunk.AddItem(item);
verify(&chunk); REQUIRE(chunk.GetSsrc() == ssrc1);
SdesItem* item1 = *(chunk.Begin());
REQUIRE(item1->GetType() == item1Type);
REQUIRE(item1->GetLength() == item1Length);
REQUIRE(std::string(item1->GetValue(), item1Length) == item1Value);
} }
} }
...@@ -40,6 +40,10 @@ int main(int argc, char* argv[]) ...@@ -40,6 +40,10 @@ int main(int argc, char* argv[])
{ {
Settings::configuration.logTags.rtp = true; Settings::configuration.logTags.rtp = true;
} }
if (std::getenv("MS_TEST_LOG_TAG_RTCP"))
{
Settings::configuration.logTags.rtcp = true;
}
// Initialize static stuff. // Initialize static stuff.
DepLibUV::ClassInit(); DepLibUV::ClassInit();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论