From 4dc09e1d513b65cbd0808b90cec58db46ee1ddba Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Thu, 5 Feb 2026 16:32:02 +0100 Subject: [PATCH] set default udpMaxPayloadSize to an IPv6 compatible value (#4882) (#5402) When using IPv6, there are 20 bytes less available for UDP payload, which has been adjusted accordingly. --- internal/conf/conf.go | 2 +- mediamtx.yml | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/conf/conf.go b/internal/conf/conf.go index 9e554f25..31099e9d 100644 --- a/internal/conf/conf.go +++ b/internal/conf/conf.go @@ -417,7 +417,7 @@ func (conf *Conf) setDefaults() { conf.ReadTimeout = 10 * Duration(time.Second) conf.WriteTimeout = 10 * Duration(time.Second) conf.WriteQueueSize = 512 - conf.UDPMaxPayloadSize = 1472 + conf.UDPMaxPayloadSize = 1452 // Authentication conf.AuthMethod = AuthMethodInternal diff --git a/mediamtx.yml b/mediamtx.yml index 986ab479..4135804f 100644 --- a/mediamtx.yml +++ b/mediamtx.yml @@ -24,9 +24,10 @@ writeTimeout: 10s # Size of the queue of outgoing packets. # A higher value allows to increase throughput, a lower value allows to save RAM. writeQueueSize: 512 -# Maximum size of outgoing UDP packets. -# This can be decreased to avoid fragmentation on networks with a low UDP MTU. -udpMaxPayloadSize: 1472 +# Maximum size of outgoing UDP payloads. +# It defaults to the maximum packet size on ethernet (1500) minus IPv6 and UDP headers (48). +# This can be decreased to avoid fragmentation on networks with a low MTU. +udpMaxPayloadSize: 1452 # Size of the read buffer of every UDP socket. # This can be increased to decrease packet losses. # It defaults to the default value of the operating system.