Skip to content

Commit

Permalink
RTCP: Adjust maximum compound packet size (#934)
Browse files Browse the repository at this point in the history
* RTCP: Adjust maximum compound packet size

Consider IP and transport header sizes on the MTU.

* Update CHANGELOG
  • Loading branch information
jmillan authored Oct 28, 2022
1 parent 397e216 commit 0ef0a68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### NEXT

* Transport: Remove duplicate call to method (PR #931).
* RTCP: Adjust maximum compound packet size (PR #934).


### 3.10.12
Expand Down
13 changes: 8 additions & 5 deletions worker/include/RTC/RTCP/CompoundPacket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ namespace RTC
class CompoundPacket
{
public:
// Maximum size for a CompundPacket, leaving free space for encryption.
// SRTP_MAX_TRAILER_LEN+4 is the maximum number of octects that will be
// added to an RTCP packet by srtp_protect_rtcp().
// srtp.h: SRTP_MAX_TRAILER_LEN (SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN)
constexpr static size_t MaxSize{ RTC::MtuSize - 148u };
// Maximum size for a CompundPacket.
// * IPv4|Ipv6 header size: 20|40 bytes. IPv6 considered.
// * UDP|TCP header size: 8|20 bytes. TCP considered.
// * SRTP Encryption: 148 bytes.
// SRTP_MAX_TRAILER_LEN+4 is the maximum number of octects that will be
// added to an RTCP packet by srtp_protect_rtcp().
// srtp.h: SRTP_MAX_TRAILER_LEN (SRTP_MAX_TAG_LEN + SRTP_MAX_MKI_LEN)
constexpr static size_t MaxSize{ RTC::MtuSize - 40u - 20u - 148u };

public:
CompoundPacket() = default;
Expand Down

0 comments on commit 0ef0a68

Please sign in to comment.