From 53297a6d16a7fe1f62a268eceb1740252946a5d7 Mon Sep 17 00:00:00 2001
From: Eloi BAIL <eloi.bail@savoirfairelinux.com>
Date: Fri, 4 Sep 2015 11:38:07 -0400
Subject: [PATCH] daemon: decrease RTP payload max size

RTP packet maximum size must rely on maximum MTU size.
Networks such as ADSL include PPPoE header that reduce maximum
payload size.
Notice that packets higher than MTU would lead to fragmentation
by routers. With high bitrates in video, we want to avoid that.

This patch proposes to reduce the maximum UDP payload size allowed
to RTP to a value safe for PPPoE MTU.

This value has been computed as follow:

Ethernet MTU          = 1500 bytes
PPPoE headers        -= 8
IP headers           -= 24
UDP headers          -= 8
----------------------------------
Total for RTP payload = 1460 bytes

Issue: #80080
Change-Id: Ibc8d5943017f3cea3ac6e1f17f90a85f06755ebe
---
 src/media/socket_pair.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/media/socket_pair.cpp b/src/media/socket_pair.cpp
index bdefa14df3..90b34a8df5 100644
--- a/src/media/socket_pair.cpp
+++ b/src/media/socket_pair.cpp
@@ -194,7 +194,8 @@ udp_socket_create(sockaddr_storage* addr, socklen_t* addr_len, int local_port)
     return udp_fd;
 }
 
-static const size_t RTP_BUFFER_SIZE = 1472;
+// Maximal size allowed for a RTP packet, this value of 1460 bytes is PPoE safe.
+static const size_t RTP_BUFFER_SIZE = 1460;
 static const size_t SRTP_BUFFER_SIZE = RTP_BUFFER_SIZE - 10;
 
 SocketPair::SocketPair(const char *uri, int localPort)
-- 
GitLab