[MPlayer-dev-eng] [PATCH] Fix a compile problem for stream/udp.c and normalize two "struct timeval"

Bernd Ernesti mplayer-dev-eng at lists.veego.de
Sat Aug 12 18:01:16 CEST 2006


Hi,

1. stream/udp.c uses select(2), but doesn't include all needed headers so I get
   this error on NetBSD:

   udp.c: In function `udp_open_socket':
   udp.c:55: error: storage size of `tv' isn't known
   gmake[1]: *** [udp.o] Error 1

2. stream/udp.c is based on stream/librtsp/rtsp_rtp.c which uses a

   tv.tv_sec = 0;
   tv.tv_usec = (1 * 1000000);  /* 1 second timeout */

   There was a patch added to the NetBSD pkgsrc tree (commited by
   Matthias Drochner):

    Log Message:
    normalize a "struct timeval" before use as timeout in select(2),
    suggested by Mihai Chelaru per PM (affects RTP)

   This patch change that to:
    tv.tv_sec = 1; /* 1 second timeout */
    tv.tv_usec = 0;
 
Attached are two patches, where patch #1 is needed and it would be nice
to have patch #2 also applied to the svn repository.

Regards,
Bernd

-------------- next part --------------
Index: stream/udp.c
===================================================================
--- stream/udp.c	(revision 19371)
+++ stream/udp.c	(working copy)
@@ -32,6 +32,7 @@
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <sys/select.h>
 #define closesocket close
 #else
 #include <winsock2.h>
-------------- next part --------------
Index: stream/udp.c
===================================================================
--- stream/udp.c	(revision 19371)
+++ stream/udp.c	(working copy)
@@ -156,8 +156,8 @@
     }
   }
 
-  tv.tv_sec = 0;
-  tv.tv_usec = (1 * 1000000);	/* 1 second timeout */
+  tv.tv_sec = 1;	/* 1 second timeout */
+  tv.tv_usec = 0;
 
   FD_ZERO (&set);
   FD_SET (socket_server_fd, &set);
Index: stream/librtsp/rtsp_rtp.c
===================================================================
--- stream/librtsp/rtsp_rtp.c	(revision 19371)
+++ stream/librtsp/rtsp_rtp.c	(working copy)
@@ -343,8 +343,8 @@
     }
   }
 
-  tv.tv_sec = 0;
-  tv.tv_usec = (1 * 1000000); /* 1 second timeout */
+  tv.tv_sec = 1; /* 1 second timeout */
+  tv.tv_usec = 0;
   
   FD_ZERO (&set);
   FD_SET (s, &set);


More information about the MPlayer-dev-eng mailing list