Created
February 18, 2014 10:44
-
-
Save eblot/9068469 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cfg-mplayer.h b/cfg-mplayer.h | |
index 4830d02..29a4365 100644 | |
--- a/cfg-mplayer.h | |
+++ b/cfg-mplayer.h | |
@@ -270,6 +270,7 @@ const m_option_t mplayer_opts[]={ | |
{"udp-master", &udp_master, CONF_TYPE_FLAG, 0, 0, 1, NULL}, | |
{"udp-ip", &udp_ip, CONF_TYPE_STRING, 0, 0, 1, NULL}, | |
{"udp-port", &udp_port, CONF_TYPE_INT, 0, 1, 65535, NULL}, | |
+ {"udp-timeout", &udp_timeout, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, | |
{"udp-seek-threshold", &udp_seek_threshold, CONF_TYPE_FLOAT, CONF_RANGE, 0.1, 100, NULL}, | |
#endif /* CONFIG_NETWORKING */ | |
diff --git a/stream/udp.c b/stream/udp.c | |
index e27808b..46b56fe 100644 | |
--- a/stream/udp.c | |
+++ b/stream/udp.c | |
@@ -47,6 +47,7 @@ | |
#include "udp.h" | |
int reuse_socket=0; | |
+int udp_timeout=1; | |
/* Start listening on a UDP port. If multicast, join the group. */ | |
int | |
@@ -165,13 +166,14 @@ udp_open_socket (URL_t *url) | |
} | |
} | |
- tv.tv_sec = 1; /* 1 second timeout */ | |
+ tv.tv_sec = udp_timeout; | |
tv.tv_usec = 0; | |
FD_ZERO (&set); | |
FD_SET (socket_server_fd, &set); | |
- err = select (socket_server_fd + 1, &set, NULL, NULL, &tv); | |
+ err = select (socket_server_fd + 1, &set, NULL, NULL, | |
+ (tv.tv_sec > 0) ? &tv : NULL); | |
if (err < 0) | |
{ | |
mp_msg (MSGT_NETWORK, MSGL_FATAL, | |
diff --git a/stream/udp.h b/stream/udp.h | |
index 49645be..7959330 100644 | |
--- a/stream/udp.h | |
+++ b/stream/udp.h | |
@@ -26,6 +26,7 @@ | |
#include "url.h" | |
extern int reuse_socket; | |
+extern int udp_timeout; | |
int udp_open_socket (URL_t *url); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment