1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: process twcc before srtp unprotected

This commit is contained in:
jinxue.cgh 2020-06-27 14:37:35 +08:00 committed by winlin
parent 121266ecbf
commit 6ff048ed35
3 changed files with 28 additions and 13 deletions

View file

@ -319,6 +319,7 @@ SrsRtpHeader::SrsRtpHeader()
sequence = 0;
timestamp = 0;
ssrc = 0;
decode_only_header_ = false;
}
SrsRtpHeader::~SrsRtpHeader()
@ -376,7 +377,7 @@ srs_error_t SrsRtpHeader::decode(SrsBuffer* buf)
}
}
if (padding && !buf->empty()) {
if (padding && !buf->empty() && !decode_only_header_) {
padding_length = *(reinterpret_cast<uint8_t*>(buf->data() + buf->size() - 1));
if (!buf->require(padding_length)) {
return srs_error_new(ERROR_RTC_RTP_MUXER, "padding requires %d bytes", padding_length);
@ -448,6 +449,11 @@ void SrsRtpHeader::set_extensions(const SrsRtpExtensionTypes* extmap)
}
}
void SrsRtpHeader::set_decode_only_header(bool only_header)
{
decode_only_header_ = only_header;
}
srs_error_t SrsRtpHeader::get_twcc_sequence_number(uint16_t& twcc_sn)
{
if (extensions_.exists()) {