mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
udpsrc: improve timeouts
Make it possible to set the timeout after we went to the READY state by using the timeout when checking the condition. This also makes it possible to set the timeout with a higher granularity than seconds.
This commit is contained in:
parent
abd7e33db6
commit
32bd981303
1 changed files with 11 additions and 7 deletions
|
@ -382,13 +382,20 @@ retry:
|
|||
goto no_select;
|
||||
|
||||
do {
|
||||
gint64 timeout;
|
||||
|
||||
try_again = FALSE;
|
||||
|
||||
GST_LOG_OBJECT (udpsrc, "doing select, timeout %" G_GUINT64_FORMAT,
|
||||
udpsrc->timeout);
|
||||
if (udpsrc->timeout)
|
||||
timeout = udpsrc->timeout / 1000;
|
||||
else
|
||||
timeout = -1;
|
||||
|
||||
if (!g_socket_condition_wait (udpsrc->used_socket, G_IO_IN | G_IO_PRI,
|
||||
udpsrc->cancellable, &err)) {
|
||||
GST_LOG_OBJECT (udpsrc, "doing select, timeout %" G_GUINT64_FORMAT,
|
||||
timeout);
|
||||
|
||||
if (!g_socket_condition_timed_wait (udpsrc->used_socket, G_IO_IN | G_IO_PRI,
|
||||
timeout, udpsrc->cancellable, &err)) {
|
||||
if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_BUSY)
|
||||
|| g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
|
||||
goto stopped;
|
||||
|
@ -808,9 +815,6 @@ gst_udpsrc_start (GstBaseSrc * bsrc)
|
|||
goto getsockname_error;
|
||||
}
|
||||
|
||||
if (src->timeout)
|
||||
g_socket_set_timeout (src->used_socket, src->timeout / GST_SECOND);
|
||||
|
||||
#ifdef SO_RCVBUF
|
||||
{
|
||||
gint rcvsize, ret;
|
||||
|
|
Loading…
Reference in a new issue