完善rtcp ext

This commit is contained in:
xia-chu 2021-05-06 12:02:16 +08:00
parent cbee3210a0
commit 842257edaa
2 changed files with 13 additions and 2 deletions

View File

@ -458,18 +458,27 @@ size_t RtpHeader::getExtSize() const {
return 0;
}
auto ext_ptr = &payload + getCsrcSize();
uint16_t reserved = AV_RB16(ext_ptr);
//uint16_t reserved = AV_RB16(ext_ptr);
//每个ext占用4字节
return AV_RB16(ext_ptr + 2) << 2;
}
uint16_t RtpHeader::getExtReserved() const{
//rtp有ext
if (!ext) {
return 0;
}
auto ext_ptr = &payload + getCsrcSize();
return AV_RB16(ext_ptr);
}
uint8_t *RtpHeader::getExtData() {
if (!ext) {
return nullptr;
}
auto ext_ptr = &payload + getCsrcSize();
//多出的4个字节分别为reserved、ext_len
return ext_ptr + 4 + getExtSize();
return ext_ptr + 4;
}
size_t RtpHeader::getPayloadOffset() const {

View File

@ -119,6 +119,8 @@ public:
//返回ext字段字节长度
size_t getExtSize() const;
//返回ext reserved值
uint16_t getExtReserved() const;
//返回ext段首地址不存在时返回nullptr
uint8_t *getExtData();