diff options
author | Jindřich Makovička <makovick@gmail.com> | 2008-11-17 07:50:25 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2008-11-17 07:50:25 +0000 |
commit | ce09d560b7e42a9ef60bbb85c6ba1e1ffc2aa16f (patch) | |
tree | 07d3cb58261ad1157f8cac1bdf4c40d3cdbb6745 | |
parent | 2bfecf733b1f46326f99ea8e8f5464c3992a1285 (diff) | |
download | ffmpeg-ce09d560b7e42a9ef60bbb85c6ba1e1ffc2aa16f.tar.gz |
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
Originally committed as revision 15846 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/udp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c index a8e8cd8bce..bbdb930e4e 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -437,6 +437,8 @@ static int udp_open(URLContext *h, const char *uri, int flags) 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_t *buf, int size) 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)) |