mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
udpsrc: factor out gst_udpsrc_get_rcvbuf()
No semantic change. https://bugzilla.gnome.org/show_bug.cgi?id=727067
This commit is contained in:
parent
cebe940c12
commit
58a5f59fe9
1 changed files with 21 additions and 10 deletions
|
@ -1296,6 +1296,24 @@ name_resolve:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint
|
||||||
|
gst_udpsrc_get_rcvbuf (GstUDPSrc * src)
|
||||||
|
{
|
||||||
|
gint val = 0;
|
||||||
|
|
||||||
|
/* read the value of the receive buffer. Note that on linux this returns
|
||||||
|
* 2x the value we set because the kernel allocates extra memory for
|
||||||
|
* metadata. The default on Linux is about 100K (which is about 50K
|
||||||
|
* without metadata) */
|
||||||
|
if (!g_socket_get_option (src->used_socket, SOL_SOCKET, SO_RCVBUF, &val,
|
||||||
|
NULL)) {
|
||||||
|
GST_DEBUG_OBJECT (src, "could not get udp buffer size");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
/* create a socket for sending to remote machine */
|
/* create a socket for sending to remote machine */
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_udpsrc_open (GstUDPSrc * src)
|
gst_udpsrc_open (GstUDPSrc * src)
|
||||||
|
@ -1387,7 +1405,7 @@ gst_udpsrc_open (GstUDPSrc * src)
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
gint val = 0;
|
gint val;
|
||||||
|
|
||||||
if (src->buffer_size != 0) {
|
if (src->buffer_size != 0) {
|
||||||
GError *opt_err = NULL;
|
GError *opt_err = NULL;
|
||||||
|
@ -1406,16 +1424,9 @@ gst_udpsrc_open (GstUDPSrc * src)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read the value of the receive buffer. Note that on linux this returns
|
val = gst_udpsrc_get_rcvbuf (src);
|
||||||
* 2x the value we set because the kernel allocates extra memory for
|
if (val)
|
||||||
* metadata. The default on Linux is about 100K (which is about 50K
|
|
||||||
* without metadata) */
|
|
||||||
if (g_socket_get_option (src->used_socket, SOL_SOCKET, SO_RCVBUF, &val,
|
|
||||||
NULL)) {
|
|
||||||
GST_INFO_OBJECT (src, "have udp buffer of %d bytes", val);
|
GST_INFO_OBJECT (src, "have udp buffer of %d bytes", val);
|
||||||
} else {
|
|
||||||
GST_DEBUG_OBJECT (src, "could not get udp buffer size");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_socket_set_broadcast (src->used_socket, TRUE);
|
g_socket_set_broadcast (src->used_socket, TRUE);
|
||||||
|
|
Loading…
Reference in a new issue