添加rtp ext: av1-rtp-spec (#2609)

Co-authored-by: xia-chu <771730766@qq.com>
This commit is contained in:
yogo-zhangyingzhe 2023-07-08 23:28:34 +08:00 committed by GitHub
parent f55e13f9da
commit 9e8568e753
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -94,6 +94,7 @@ uint8_t RtpExtOneByte::getId() const {
}
void RtpExtOneByte::setId(uint8_t in) {
CHECK(in < (int)RtpExtType::reserved);
id = in & 0x0F;
}
@ -143,8 +144,6 @@ void appendExt(map<uint8_t, RtpExt> &ret, uint8_t *ptr, const uint8_t *end) {
++ptr;
continue;
}
//15类型的rtp ext为保留
CHECK(ext->getId() < (uint8_t) RtpExtType::reserved);
CHECK(reinterpret_cast<uint8_t *>(ext) + Type::kMinSize <= end);
CHECK(ext->getData() + ext->getSize() <= end);
ret.emplace(ext->getId(), RtpExt(ext, isOneByteExt<Type>(), reinterpret_cast<char *>(ext->getData()), ext->getSize()));
@ -522,8 +521,13 @@ uint8_t RtpExt::getFramemarkingTID() const {
}
void RtpExt::setExtId(uint8_t ext_id) {
assert(ext_id > (int) RtpExtType::padding && ext_id <= (int) RtpExtType::reserved && _ext);
assert(ext_id > (int) RtpExtType::padding && _ext);
if (_one_byte_ext) {
if (ext_id >= (int)RtpExtType::reserved) {
WarnL << "One byte rtp ext can not store id " << (int)ext_id << "(" << getExtName((RtpExtType)ext_id) << ") big than 14";
clearExt();
return;
}
auto ptr = reinterpret_cast<RtpExtOneByte *>(_ext);
ptr->setId(ext_id);
} else {

View File

@ -34,6 +34,7 @@ namespace mediakit {
XX(playout_delay, "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay") \
XX(video_orientation, "urn:3gpp:video-orientation") \
XX(toffset, "urn:ietf:params:rtp-hdrext:toffset") \
XX(av1, "https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension") \
XX(encrypt, "urn:ietf:params:rtp-hdrext:encrypt")
enum class RtpExtType : uint8_t {
@ -41,7 +42,7 @@ enum class RtpExtType : uint8_t {
#define XX(type, uri) type,
RTP_EXT_MAP(XX)
#undef XX
reserved = encrypt,
reserved = 15,
};
class RtcMedia;