mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Parse TWCC SN fastly.
This commit is contained in:
parent
79a6907a65
commit
719df6fa41
3 changed files with 65 additions and 8 deletions
|
@ -1132,19 +1132,12 @@ srs_error_t SrsRtcPublishStream::on_rtp(char* data, int nb_data)
|
|||
|
||||
// Decode the header first.
|
||||
if (twcc_id_) {
|
||||
SrsRtpHeader h;
|
||||
SrsBuffer b(data, nb_data);
|
||||
h.ignore_padding(true); h.set_extensions(&extension_types_);
|
||||
if ((err = h.decode(&b)) != srs_success) {
|
||||
return srs_error_wrap(err, "twcc decode header");
|
||||
}
|
||||
|
||||
// We must parse the TWCC from RTP header before SRTP unprotect, because:
|
||||
// 1. Client may send some padding packets with invalid SequenceNumber, which causes the SRTP fail.
|
||||
// 2. Server may send multiple duplicated NACK to client, and got more than one ARQ packet, which also fail SRTP.
|
||||
// so, we must parse the header before SRTP unprotect(which may fail and drop packet).
|
||||
uint16_t twcc_sn = 0;
|
||||
if ((err = h.get_twcc_sequence_number(twcc_sn)) == srs_success) {
|
||||
if ((err = srs_rtp_fast_parse_twcc(data, nb_data, &extension_types_, twcc_sn)) == srs_success) {
|
||||
if((err = on_twcc(twcc_sn)) != srs_success) {
|
||||
return srs_error_wrap(err, "on twcc");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue