[PATCH] Broken RTP timeout checking
Hi all, When opening an RTP session, mplayer first checks if there is any traffic on the channel, and times out and returns an error if there is none. But this timeout checking is broken due to the wrong condition being tested. Here's a patch to correct it. Please consider. Selwyn Index: network.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v retrieving revision 1.107 diff -u -r1.107 network.c --- network.c 22 Nov 2004 19:45:55 -0000 1.107 +++ network.c 14 Dec 2004 06:11:31 -0000 @@ -1165,16 +1165,19 @@ tv.tv_usec = (1 * 1000000); // 1 second timeout FD_ZERO( &set ); FD_SET( socket_server_fd, &set ); - if( select(socket_server_fd+1, &set, NULL, NULL, &tv)>0 ) { + if( (err = select(socket_server_fd+1, &set, NULL, NULL, &tv))<=0 ) { //if( select(socket_server_fd+1, &set, NULL, NULL, NULL)>0 ) { + if (!err) { + mp_msg(MSGT_NETWORK,MSGL_ERR,"Timeout! No data from host %s\n", url->hostname ); + } else { err_len = sizeof( err ); getsockopt( socket_server_fd, SOL_SOCKET, SO_ERROR, &err, &err_len ); if( err ) { - mp_msg(MSGT_NETWORK,MSGL_ERR,"Timeout! No data from host %s\n", url->hostname ); mp_msg(MSGT_NETWORK,MSGL_DBG2,"Socket error: %d\n", err ); + } + } closesocket(socket_server_fd); return -1; - } } return socket_server_fd; }
On 12/14/04 14:21, Selwyn Tang wrote:
When opening an RTP session, mplayer first checks if there is any traffic on the channel, and times out and returns an error if there is none. But this timeout checking is broken due to the wrong condition being tested. Here's a patch to correct it. Please consider.
This can be verified by "mplayer rtp://239.255.x.x" where there is no traffic on that address. Notice how mplayer just sits there waiting for incoming traffic instead of timing out. Selwyn
Hi, On Tue, Dec 14, 2004 at 02:21:09PM +0800, Selwyn Tang wrote:
When opening an RTP session, mplayer first checks if there is any traffic on the channel, and times out and returns an error if there is none. But this timeout checking is broken due to the wrong condition being tested. Here's a patch to correct it. Please consider.
Applied a different (but similar) fix. Greetings, Reimar Döffinger
participants (2)
-
Reimar Döffinger -
Selwyn Tang