From a3a1656e9050ef1964764e67e8a13fb669c2dbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Fri, 28 Oct 2022 13:56:18 +0200 Subject: [PATCH] RTCP: Adjust maximum compound packet size (#934) * RTCP: Adjust maximum compound packet size Consider IP and transport header sizes on the MTU. * Update CHANGELOG --- CHANGELOG.md | 1 + worker/include/RTC/RTCP/CompoundPacket.hpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7c9637cf10..73d72c17625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### NEXT * Transport: Remove duplicate call to method (PR #931). +* RTCP: Adjust maximum compound packet size (PR #934). ### 3.10.12 diff --git a/worker/include/RTC/RTCP/CompoundPacket.hpp b/worker/include/RTC/RTCP/CompoundPacket.hpp index a250b5c5b84..3e377d394a7 100644 --- a/worker/include/RTC/RTCP/CompoundPacket.hpp +++ b/worker/include/RTC/RTCP/CompoundPacket.hpp @@ -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;