提交 d3332d62 authored 作者: José Luis Millán's avatar José Luis Millán

Worker tests: RTCP AFB

上级 19e013e1
...@@ -21,7 +21,6 @@ const workerFiles = ...@@ -21,7 +21,6 @@ const workerFiles =
'worker/src/**/*.cpp', 'worker/src/**/*.cpp',
'worker/include/**/*.hpp', 'worker/include/**/*.hpp',
'worker/test/**/*.cpp' 'worker/test/**/*.cpp'
]; ];
const nodeTests = const nodeTests =
[ [
......
...@@ -269,6 +269,7 @@ ...@@ -269,6 +269,7 @@
'test/RTC/TestRtpStreamRecv.cpp', 'test/RTC/TestRtpStreamRecv.cpp',
'test/RTC/TestSeqManager.cpp', 'test/RTC/TestSeqManager.cpp',
'test/RTC/RTCP/TestFeedbackPs.cpp', 'test/RTC/RTCP/TestFeedbackPs.cpp',
'test/RTC/RTCP/TestFeedbackPsAfb.cpp',
'test/RTC/RTCP/TestFeedbackRtp.cpp', 'test/RTC/RTCP/TestFeedbackRtp.cpp',
'test/RTC/RTCP/TestBye.cpp', 'test/RTC/RTCP/TestBye.cpp',
'test/RTC/RTCP/TestReceiverReport.cpp', 'test/RTC/RTCP/TestReceiverReport.cpp',
......
#include "common.hpp" #include "common.hpp"
#include "catch.hpp" #include "catch.hpp"
#include "RTC/RTCP/FeedbackPsAfb.hpp"
#include "RTC/RTCP/FeedbackPsFir.hpp" #include "RTC/RTCP/FeedbackPsFir.hpp"
#include "RTC/RTCP/FeedbackPsLei.hpp" #include "RTC/RTCP/FeedbackPsLei.hpp"
#include "RTC/RTCP/FeedbackPsRemb.hpp" #include "RTC/RTCP/FeedbackPsRemb.hpp"
...@@ -19,7 +18,7 @@ namespace TestFeedbackPsRemb ...@@ -19,7 +18,7 @@ namespace TestFeedbackPsRemb
// clang-format off // clang-format off
uint8_t buffer[] = uint8_t buffer[] =
{ {
0x8f, 0xce, 0x00, 0x06, // Type: 206 (Payload Specific), Length: 6 0x8f, 0xce, 0x00, 0x06, // Type: 206 (Payload Specific), Count: 15 (AFB), Length: 6
0xfa, 0x17, 0xfa, 0x17, // Sender SSRC: 0xfa17fa17 0xfa, 0x17, 0xfa, 0x17, // Sender SSRC: 0xfa17fa17
0x00, 0x00, 0x00, 0x00, // Media source SSRC: 0x00000000 0x00, 0x00, 0x00, 0x00, // Media source SSRC: 0x00000000
0x52, 0x45, 0x4d, 0x42, // Unique Identifier: REMB 0x52, 0x45, 0x4d, 0x42, // Unique Identifier: REMB
...@@ -193,29 +192,6 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]") ...@@ -193,29 +192,6 @@ SCENARIO("RTCP Feedback PS parsing", "[parser][rtcp][feedback-ps]")
delete item; delete item;
} }
SECTION("parse FeedbackPsAfbPacket")
{
// clang-format off
uint8_t buffer[] =
{
0x8F, 0xce, 0x00, 0x03, // RTCP common header
0x00, 0x00, 0x00, 0x00, // Sender SSRC
0x00, 0x00, 0x00, 0x00, // Media SSRC
0x00, 0x00, 0x00, 0x01 // Data
};
// clang-format on
size_t dataSize = 4;
uint8_t dataBitmask = 1;
FeedbackPsAfbPacket* packet = FeedbackPsAfbPacket::Parse(buffer, sizeof(buffer));
REQUIRE(packet);
REQUIRE(packet->GetApplication() == FeedbackPsAfbPacket::Application::UNKNOWN);
delete packet;
}
SECTION("parse FeedbackPsRembPacket") SECTION("parse FeedbackPsRembPacket")
{ {
using namespace TestFeedbackPsRemb; using namespace TestFeedbackPsRemb;
......
#include "common.hpp"
#include "catch.hpp"
#include "RTC/RTCP/FeedbackPsAfb.hpp"
#include <cstring> // std::memcmp()
using namespace RTC::RTCP;
namespace TestFeedbackPsAfb
{
// RTCP AFB packet.
// clang-format off
uint8_t buffer[] =
{
0x8f, 0xce, 0x00, 0x03, // Type: 206 (Payload Specific), Count: 15 (AFB) Length: 3
0xfa, 0x17, 0xfa, 0x17, // Sender SSRC: 0xfa17fa17
0x00, 0x00, 0x00, 0x00, // Media source SSRC: 0x00000000
0x00, 0x00, 0x00, 0x01 // Data
};
// clang-format on
// AFB values.
uint32_t senderSsrc = 0xfa17fa17;
uint32_t mediaSsrc = 0;
size_t dataSize = 4;
uint8_t dataBitmask = 1;
void verifyAfbPacket(FeedbackPsAfbPacket* packet)
{
REQUIRE(packet->GetSenderSsrc() == senderSsrc);
REQUIRE(packet->GetMediaSsrc() == mediaSsrc);
REQUIRE(packet->GetApplication() == FeedbackPsAfbPacket::Application::UNKNOWN);
}
}
SCENARIO("RTCP Feedback PS AFB parsing", "[parser][rtcp][feedback-ps][afb]")
{
SECTION("parse FeedbackPsAfbPacket")
{
using namespace TestFeedbackPsAfb;
FeedbackPsAfbPacket* packet = FeedbackPsAfbPacket::Parse(buffer, sizeof(buffer));
REQUIRE(packet);
verifyAfbPacket(packet);
SECTION("serialize packet instance")
{
uint8_t serialized[sizeof(buffer)] = { 0 };
packet->Serialize(serialized);
SECTION("compare serialized packet with original buffer")
{
REQUIRE(std::memcmp(buffer, serialized, sizeof(buffer)) == 0);
}
}
delete packet;
}
}
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论