mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
gst/udp/gstudpsrc.c: Improve UDP performance by avoiding a select() when we have data available immediatly.
Original commit message from CVS: * gst/udp/gstudpsrc.c: (gst_udpsrc_create): Improve UDP performance by avoiding a select() when we have data available immediatly.
This commit is contained in:
parent
41f0496738
commit
042d3a461c
2 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-08-16 Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
|
||||||
|
* gst/udp/gstudpsrc.c: (gst_udpsrc_create):
|
||||||
|
Improve UDP performance by avoiding a select() when we have data
|
||||||
|
available immediatly.
|
||||||
|
|
||||||
2007-08-16 Wim Taymans <wim.taymans@gmail.com>
|
2007-08-16 Wim Taymans <wim.taymans@gmail.com>
|
||||||
|
|
||||||
* gst/rtsp/gstrtpdec.c: (gst_rtp_dec_marshal_VOID__UINT_UINT),
|
* gst/rtsp/gstrtpdec.c: (gst_rtp_dec_marshal_VOID__UINT_UINT),
|
||||||
|
|
|
@ -368,6 +368,14 @@ gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||||
|
|
||||||
udpsrc = GST_UDPSRC (psrc);
|
udpsrc = GST_UDPSRC (psrc);
|
||||||
|
|
||||||
|
/* quick check, avoid going in select when we already have data */
|
||||||
|
readsize = 0;
|
||||||
|
if ((ret = IOCTL_SOCKET (udpsrc->sock, FIONREAD, &readsize)) < 0)
|
||||||
|
goto ioctl_failed;
|
||||||
|
|
||||||
|
if (readsize > 0)
|
||||||
|
goto no_select;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
gboolean stop;
|
gboolean stop;
|
||||||
struct timeval timeval, *timeout;
|
struct timeval timeval, *timeout;
|
||||||
|
@ -433,11 +441,12 @@ gst_udpsrc_create (GstPushSrc * psrc, GstBuffer ** buf)
|
||||||
if ((ret = IOCTL_SOCKET (udpsrc->sock, FIONREAD, &readsize)) < 0)
|
if ((ret = IOCTL_SOCKET (udpsrc->sock, FIONREAD, &readsize)) < 0)
|
||||||
goto ioctl_failed;
|
goto ioctl_failed;
|
||||||
|
|
||||||
GST_LOG_OBJECT (udpsrc, "ioctl says %d bytes available", (int) readsize);
|
|
||||||
|
|
||||||
if (!readsize)
|
if (!readsize)
|
||||||
goto nothing_to_read;
|
goto nothing_to_read;
|
||||||
|
|
||||||
|
no_select:
|
||||||
|
GST_LOG_OBJECT (udpsrc, "ioctl says %d bytes available", (int) readsize);
|
||||||
|
|
||||||
pktdata = g_malloc (readsize);
|
pktdata = g_malloc (readsize);
|
||||||
pktsize = readsize;
|
pktsize = readsize;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue