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

Tests: add RTCP PSFB VBCM tests

上级 3d7e14b8
...@@ -32,7 +32,7 @@ namespace RTC { namespace RTCP ...@@ -32,7 +32,7 @@ namespace RTC { namespace RTCP
uint8_t zero:1; uint8_t zero:1;
uint8_t payload_type:7; uint8_t payload_type:7;
uint16_t length; uint16_t length;
uint8_t* value; uint8_t value[];
}; };
public: public:
...@@ -107,7 +107,7 @@ namespace RTC { namespace RTCP ...@@ -107,7 +107,7 @@ namespace RTC { namespace RTCP
inline inline
uint16_t VbcmItem::GetLength() uint16_t VbcmItem::GetLength()
{ {
return (uint16_t)this->header->length; return (uint16_t)ntohs(this->header->length);
} }
inline inline
......
...@@ -35,7 +35,7 @@ namespace RTC { namespace RTCP ...@@ -35,7 +35,7 @@ namespace RTC { namespace RTCP
this->header->zero = 0; this->header->zero = 0;
this->header->payload_type = payload_type; this->header->payload_type = payload_type;
this->header->length = htons(length); this->header->length = htons(length);
this->header->value = value; std::memcpy(this->header->value, value, sizeof(length));
} }
size_t VbcmItem::Serialize(uint8_t* data) size_t VbcmItem::Serialize(uint8_t* data)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "RTC/RTCP/FeedbackPsRpsi.h" #include "RTC/RTCP/FeedbackPsRpsi.h"
#include "RTC/RTCP/FeedbackPsFir.h" #include "RTC/RTCP/FeedbackPsFir.h"
#include "RTC/RTCP/FeedbackPsTst.h" #include "RTC/RTCP/FeedbackPsTst.h"
#include "RTC/RTCP/FeedbackPsVbcm.h"
#include "Logger.h" #include "Logger.h"
#include <string> #include <string>
...@@ -570,5 +571,36 @@ FCTMF_SUITE_BGN(test_rtcp) ...@@ -570,5 +571,36 @@ FCTMF_SUITE_BGN(test_rtcp)
delete item; delete item;
} }
FCT_TEST_END() FCT_TEST_END()
FCT_TEST_BGN(parse_psfb_vbcm_item)
{
uint8_t buffer[] =
{
0x00, 0x00, 0x00, 0x00, // SSRC
0x08, // Seq nr.
0x02, // Zero | Payload Vbcm
0x00, 0x01, // Length
0x01, // VBCM Octet String
0x00, 0x00, 0x00 // Padding
};
uint32_t ssrc = 0;
uint8_t seq = 8;
uint8_t payloadType = 1;
uint16_t length = 1;
uint8_t valueMask = 1;
VbcmItem* item = VbcmItem::Parse(buffer, sizeof(buffer));
fct_req(item != nullptr);
fct_chk_eq_int(item->GetSsrc(), ssrc);
fct_chk_eq_int(item->GetSequenceNumber(), seq);
fct_chk_eq_int(item->GetPayloadType(), payloadType);
fct_chk_eq_int(item->GetLength(), length);
fct_chk_eq_int(item->GetValue()[item->GetLength() -1] & 1, valueMask);
delete item;
}
FCT_TEST_END()
} }
FCTMF_SUITE_END(); FCTMF_SUITE_END();
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论