Skip to content

GStreamer UDP receive buffer (8 MB) fails without net.core.rmem_max privilege #14448

@DonLakeFlyer

Description

@DonLakeFlyer

Problem

When receiving UDP video streams, QGC explicitly sets an 8 MB socket receive buffer on the GStreamer udpsrc element (GstVideoReceiver.cc line 761):

g_object_set(source,
             "uri", uri.toUtf8().constData(),
             "buffer-size", 8 * 1024 * 1024,  // 8388608 bytes
             nullptr);

GStreamer passes this value to setsockopt(SO_RCVBUF, 8388608). On Linux, the kernel rejects this if the process lacks CAP_NET_ADMIN and net.core.rmem_max is below 8 MB (the default is ~208 KB on most distros).

Symptoms

The following warnings appear in the QGC log:

Could not create a buffer of requested 8388608 bytes (Operation not permitted). Need net.admin privilege? - Video.GStreamer.GstVideoReceiver
GStreamer warning: Could not get/set settings from/on resource. debug: ../gst/udp/gstudpsrc.c: gst_udpsrc_open(): /GstPipeline:receiver/GstBin:sourcebin/GstUDPSrc:source

Impact

The UDP pipeline still starts, but with the kernel's default receive buffer. Under high-bitrate or high-latency conditions, the small buffer fills up before the app can read it, resulting in UDP packet drops and degraded video quality.

Fix / Workaround

Raise the kernel socket receive buffer limit:

# Permanent fix
echo "net.core.rmem_max=8388608" | sudo tee /etc/sysctl.d/99-udp-rmem.conf
sudo sysctl -p /etc/sysctl.d/99-udp-rmem.conf

Consider also:

  • Documenting this requirement in the Linux install/setup guide.
  • Falling back gracefully and logging a clear user-facing message when the buffer size cannot be set.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions