Skip to content

Commit

Permalink
Avoid generating malformed padding packets (#1816)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun authored May 25, 2022
1 parent 19b1c47 commit f9fca4e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion erizo/src/erizo/rtp/RtpPaddingGeneratorHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ void RtpPaddingGeneratorHandler::recalculatePaddingRate(uint64_t target_padding_
}
uint64_t bytes_per_marker = target_padding_bitrate / (marker_rate * 8);
number_of_full_padding_packets_ = bytes_per_marker / (kMaxPaddingSize + rtp_header_length_);
last_padding_packet_size_ = bytes_per_marker % (kMaxPaddingSize + rtp_header_length_) - rtp_header_length_;
int last_payload_size =
static_cast<int>(bytes_per_marker % (kMaxPaddingSize + rtp_header_length_) - rtp_header_length_);
int clamped_payload_size =
std::clamp(last_payload_size,
0, static_cast<int>(kMaxPaddingSize));
last_padding_packet_size_ = static_cast<uint8_t>(clamped_payload_size);
}

uint64_t RtpPaddingGeneratorHandler::getBurstSize() {
Expand Down

0 comments on commit f9fca4e

Please sign in to comment.