From c61bcb1fd2fcdd666c975f6ac571041ef133f430 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 17 Aug 2018 14:17:39 -0400 Subject: [PATCH] udpsrc: Balance Linux value of get/set_rcvbuf On Linux, the kernel returns twice the size as it will allocate extra space for accouting. We devides this value by two in order to ensure that get/set value now match. This fixes the set buffer size validation and allow having a nice warning when the size if surpassed and the process does not have CAP_NET_ADMIN capabilities. https://bugzilla.gnome.org/show_bug.cgi?id=727067 --- gst/udp/gstudpsrc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst/udp/gstudpsrc.c b/gst/udp/gstudpsrc.c index 53c8e48347..486938c935 100644 --- a/gst/udp/gstudpsrc.c +++ b/gst/udp/gstudpsrc.c @@ -1310,6 +1310,10 @@ gst_udpsrc_get_rcvbuf (GstUDPSrc * src) GST_DEBUG_OBJECT (src, "could not get udp buffer size"); return 0; } +#ifdef __linux__ + /* Devise by 2 so that the numbers matches when we do get/set */ + val /= 2; +#endif return val; }