[FFmpeg-cvslog] r15846 - trunk/libavformat/udp.c

benoit subversion
Mon Nov 17 08:50:25 CET 2008


Author: benoit
Date: Mon Nov 17 08:50:25 2008
New Revision: 15846

Log:
Get rid of MSG_DONTWAIT using a more standard way to use a socket
in a non blocked mode.
Patch by Jindrich Makovicka: makovick gmail


Modified:
   trunk/libavformat/udp.c

Modified: trunk/libavformat/udp.c
==============================================================================
--- trunk/libavformat/udp.c	(original)
+++ trunk/libavformat/udp.c	Mon Nov 17 08:50:25 2008
@@ -437,6 +437,8 @@ static int udp_open(URLContext *h, const
         if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp)) < 0) {
             av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_RECVBUF): %s\n", strerror(errno));
         }
+        /* make the socket non-blocking */
+        ff_socket_nonblock(udp_fd, 1);
     }
 
     s->udp_fd = udp_fd;
@@ -468,7 +470,7 @@ static int udp_read(URLContext *h, uint8
             return AVERROR(EIO);
         if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
             continue;
-        len = recv(s->udp_fd, buf, size, MSG_DONTWAIT);
+        len = recv(s->udp_fd, buf, size, 0);
         if (len < 0) {
             if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
                 ff_neterrno() != FF_NETERROR(EINTR))




More information about the ffmpeg-cvslog mailing list