Skip to content

Commit

Permalink
RTC: Refine ID parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 24, 2021
1 parent 89f941f commit 0cb05a2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions trunk/src/kernel/srs_kernel_rtc_rtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ srs_error_t SrsRtpExtensions::decode_0xbede(SrsBuffer* buf)
// Note that 'len' is the header extension element length, which is the
// number of bytes - 1.
uint8_t id = (v & 0xF0) >> 4;
uint8_t len = (v & 0x0F);
uint8_t len = (v & 0x0F) + 1;

SrsRtpExtensionType xtype = types_? types_->get_type(id) : kRtpExtensionNone;
if (xtype == kRtpExtensionTransportSequenceNumber) {
Expand All @@ -421,18 +421,18 @@ srs_error_t SrsRtpExtensions::decode_0xbede(SrsBuffer* buf)
}
has_ext_ = true;
} else {
if (!buf->require(len+1+1)) {
return srs_error_new(ERROR_RTC_RTP_MUXER, "requires %d bytes", len+1+1);
if (!buf->require(len+1)) {
return srs_error_new(ERROR_RTC_RTP_MUXER, "requires %d bytes", len+1);
}
buf->skip(len + 1 + 1);
buf->skip(len + 1);
}
} else if (xtype == kRtpExtensionAudioLevel) {
if((err = audio_level_.decode(buf)) != srs_success) {
return srs_error_wrap(err, "decode audio level extension");
}
has_ext_ = true;
} else {
buf->skip(1 + (len + 1));
buf->skip(1 + len);
}
}

Expand Down

0 comments on commit 0cb05a2

Please sign in to comment.