[MPlayer-dev-eng] [PATCH] Sets no send/receive timeouts on tcp socket.
Andrei Katsuk
steep8 at gmail.com
Mon Oct 4 08:33:35 CEST 2010
Hello!
Hello!
I wrote a patch that implements the following feature: no change tcp
send/recv timeouts.
It is useful if you want to play media file over slow http-stream.
The command option for this feature is "no-sendrecv-timeouts".
Regards.
Katsuk Andrei.
-------------- next part --------------
Index: stream/tcp.c
===================================================================
--- stream/tcp.c (revision 32419)
+++ stream/tcp.c (working copy)
@@ -53,6 +53,7 @@
/* IPv6 options */
int network_prefer_ipv4 = 0;
+int no_sendrecv_timeouts = 0;
// Converts an address family constant to a string
@@ -115,17 +116,19 @@
return TCP_ERROR_FATAL;
}
+ if(no_sendrecv_timeouts != 1) {
#if defined(SO_RCVTIMEO) && defined(SO_SNDTIMEO)
#if HAVE_WINSOCK2_H
- /* timeout in milliseconds */
- to = 10 * 1000;
+ /* timeout in milliseconds */
+ to = 10 * 1000;
#else
- to.tv_sec = 10;
- to.tv_usec = 0;
+ to.tv_sec = 10;
+ to.tv_usec = 0;
#endif
- setsockopt(socket_server_fd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to));
- setsockopt(socket_server_fd, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof(to));
+ setsockopt(socket_server_fd, SOL_SOCKET, SO_RCVTIMEO, &to, sizeof(to));
+ setsockopt(socket_server_fd, SOL_SOCKET, SO_SNDTIMEO, &to, sizeof(to));
#endif
+ }
switch (af) {
case AF_INET: our_s_addr = (void *) &server_address.four.sin_addr; break;
Index: stream/tcp.h
===================================================================
--- stream/tcp.h (revision 32419)
+++ stream/tcp.h (working copy)
@@ -26,6 +26,7 @@
#define MPLAYER_TCP_H
extern int network_prefer_ipv4;
+extern int no_sendrecv_timeouts;
/* Connect to a server using a TCP connection */
int connect2Server (char *host, int port, int verb);
Index: DOCS/man/en/mplayer.1
===================================================================
--- DOCS/man/en/mplayer.1 (revision 32419)
+++ DOCS/man/en/mplayer.1 (working copy)
@@ -1224,7 +1224,11 @@
.B \-udp\-slave
Listen on \-udp\-port and match the master's position.
.
+.TP
+.B \-no\-sendrecv\-timeouts
+Sets no send/receive timeouts on tcp socket.
.
+.
.SH "DEMUXER/STREAM OPTIONS"
.
.TP
Index: cfg-mplayer.h
===================================================================
--- cfg-mplayer.h (revision 32419)
+++ cfg-mplayer.h (working copy)
@@ -277,6 +277,7 @@
{"udp-ip", &udp_ip, CONF_TYPE_STRING, 0, 0, 1, NULL},
{"udp-port", &udp_port, CONF_TYPE_INT, 0, 1, 65535, NULL},
{"udp-seek-threshold", &udp_seek_threshold, CONF_TYPE_FLOAT, CONF_RANGE, 0.1, 100, NULL},
+ {"no-sendrecv-timeouts", &no_sendrecv_timeouts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
#endif /* CONFIG_NETWORKING */
// dump some stream out instead of playing the file
More information about the MPlayer-dev-eng
mailing list