Commit f625b3fb by xia-chu

无法处理的rtp ext清空

parent d5eb486f
...@@ -525,6 +525,17 @@ void RtpExt::setExtId(uint8_t ext_id) { ...@@ -525,6 +525,17 @@ void RtpExt::setExtId(uint8_t ext_id) {
} }
} }
void RtpExt::clearExt(){
assert(_ptr);
if (_one_byte_ext) {
auto ptr = reinterpret_cast<RtpExtOneByte *>(_ptr);
memset(ptr, (int) RtpExtType::padding, RtpExtOneByte::kMinSize + ptr->getSize());
} else {
auto ptr = reinterpret_cast<RtpExtTwoByte *>(_ptr);
memset(ptr, (int) RtpExtType::padding, RtpExtTwoByte::kMinSize + ptr->getSize());
}
}
void RtpExt::setType(RtpExtType type) { void RtpExt::setType(RtpExtType type) {
_type = type; _type = type;
} }
...@@ -90,6 +90,7 @@ public: ...@@ -90,6 +90,7 @@ public:
//危险函数,必须保证关联的RtpHeader对象有效 //危险函数,必须保证关联的RtpHeader对象有效
void setExtId(uint8_t ext_id); void setExtId(uint8_t ext_id);
void clearExt();
private: private:
RtpExt(void *ptr, bool one_byte_ext, const char *str, size_t size); RtpExt(void *ptr, bool one_byte_ext, const char *str, size_t size);
......
...@@ -663,6 +663,7 @@ static void changeRtpExtId(const RtpPacket::Ptr &rtp, const Type &map) { ...@@ -663,6 +663,7 @@ static void changeRtpExtId(const RtpPacket::Ptr &rtp, const Type &map) {
auto it = map.find((Type::key_type) pr.first); auto it = map.find((Type::key_type) pr.first);
if (it == map.end()) { if (it == map.end()) {
WarnL << "未处理的rtp ext, 类型不识别:" << (int) pr.first; WarnL << "未处理的rtp ext, 类型不识别:" << (int) pr.first;
pr.second.clearExt();
continue; continue;
} }
setExtType(pr.second, it->first); setExtType(pr.second, it->first);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论