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

Rtcp: add missing RTCP Feedback Message types

上级 2e75da78
......@@ -43,17 +43,24 @@ namespace RTC { namespace RTCP
{
public:
enum class MessageType : uint8_t
typedef enum MessageType : uint8_t
{
PLI = 1,
SLI = 2,
RPSI = 3,
FIR = 4,
TSTR = 5,
TSTN = 6,
VBCM = 7,
PSLEI = 8,
ROI = 9,
AFB = 15,
EXT = 31
};
} MessageType;
public:
static FeedbackPsPacket* Parse(const uint8_t* data, size_t len);
static const std::string& Type2String(MessageType type);
public:
// Parsed Report. Points to an external data.
......@@ -64,6 +71,9 @@ namespace RTC { namespace RTCP
private:
MessageType messageType;
private:
static std::map<FeedbackPsPacket::MessageType, std::string> type2String;
};
class FeedbackRtpPacket
......@@ -71,13 +81,22 @@ namespace RTC { namespace RTCP
{
public:
enum class MessageType : uint8_t
typedef enum MessageType : uint8_t
{
NACK = 1
};
NACK = 1,
TMMBR = 3,
TMMBN = 4,
SR_REQ = 5,
RAMS = 6,
TLLEI = 7,
ECN_FB = 8,
PS = 9,
EXT = 31
} MessageType;
public:
static FeedbackRtpPacket* Parse(const uint8_t* data, size_t len);
static const std::string& Type2String(MessageType type);
public:
// Parsed Report. Points to an external data.
......@@ -88,6 +107,9 @@ namespace RTC { namespace RTCP
private:
MessageType messageType;
private:
static std::map<FeedbackRtpPacket::MessageType, std::string> type2String;
};
/* FeedbackPacket inline instance methods. */
......
......@@ -49,6 +49,22 @@ namespace RTCP
MS_WARN("\tmedia_ssrc: %u", ntohl(this->header->m_ssrc));
}
/* FeedbackPsPacket Class variables */
std::map<FeedbackPsPacket::MessageType, std::string> FeedbackPsPacket::type2String =
{
{ PLI, "PLI" },
{ SLI, "SLI" },
{ RPSI, "RPSI" },
{ FIR, "FIR" },
{ TSTR, "TSTR" },
{ TSTN, "TSTN" },
{ VBCM, "VBCM" },
{ PSLEI, "PSLEI" },
{ ROI, "ROI" },
{ AFB, "AFB" },
{ EXT, "EXT" }
};
/* FeedbackPsPacket Class methods. */
FeedbackPsPacket* FeedbackPsPacket::Parse(const uint8_t* data, size_t len)
......@@ -67,6 +83,16 @@ namespace RTCP
return packet.release();
}
const std::string& FeedbackPsPacket::Type2String(MessageType type)
{
static const std::string unknown("UNKNOWN");
if (type2String.find(type) == type2String.end())
return unknown;
return type2String[type];
}
/* FeedbackPsPacket Instance methods. */
FeedbackPsPacket::FeedbackPsPacket(CommonHeader* commonHeader):
......@@ -84,10 +110,24 @@ namespace RTCP
MS_WARN("<FeedbackPsPacket>");
FeedbackPacket::Dump();
MS_WARN("\tmessageType: %u", (uint8_t)this->messageType);
MS_WARN("\tmessageType: %s", Type2String(this->messageType).c_str());
MS_WARN("</FeedbackPsPacket>");
}
/* FeedbackRtpPacket Class variables */
std::map<FeedbackRtpPacket::MessageType, std::string> FeedbackRtpPacket::type2String =
{
{ NACK, "NACK" },
{ TMMBR, "TMMBR" },
{ TMMBN, "TMMBN" },
{ SR_REQ, "SR_REQ" },
{ RAMS, "RAMS" },
{ TLLEI, "TLLEI" },
{ ECN_FB, "ECN_FB" },
{ PS, "PS" },
{ EXT, "EXT" }
};
/* FeedbackRtpPacket Class methods. */
FeedbackRtpPacket* FeedbackRtpPacket::Parse(const uint8_t* data, size_t len)
......@@ -106,6 +146,16 @@ namespace RTCP
return packet.release();
}
const std::string& FeedbackRtpPacket::Type2String(MessageType type)
{
static const std::string unknown("UNKNOWN");
if (type2String.find(type) == type2String.end())
return unknown;
return type2String[type];
}
/* FeedbackRtpPacket Instance methods. */
FeedbackRtpPacket::FeedbackRtpPacket(CommonHeader* commonHeader):
......@@ -125,7 +175,7 @@ namespace RTCP
MS_WARN("<FeedbackRtpPacket>");
FeedbackPacket::Dump();
MS_WARN("\tmessageType: %u", (uint8_t)this->messageType);
MS_WARN("\tmessageType: %s", Type2String(this->messageType).c_str());
MS_WARN("</FeedbackRtpPacket>");
}
}
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论