diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2011-01-28 03:12:21 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2011-01-28 15:45:19 +0100 |
commit | a8475bbdb64e638bd8161df9647876fd23f8a29a (patch) | |
tree | 06d3c3a4999b0085f3fa0dbc8fa49cccb27350b7 /libavformat/rtspenc.c | |
parent | 5ce5dbc5f3d0bce1f8d76fea1907c91469ebdd01 (diff) | |
download | ffmpeg-a8475bbdb64e638bd8161df9647876fd23f8a29a.tar.gz |
os: replace select with poll
Select has limitations on the fd values it could accept and silently
breaks when it is reached.
Diffstat (limited to 'libavformat/rtspenc.c')
-rw-r--r-- | libavformat/rtspenc.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index dc8ecd80f2..88f093f5c1 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -22,8 +22,8 @@ #include "avformat.h" #include <sys/time.h> -#if HAVE_SYS_SELECT_H -#include <sys/select.h> +#if HAVE_POLL_H +#include <poll.h> #endif #include "network.h" #include "rtsp.h" @@ -172,23 +172,16 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; - fd_set rfds; - int n, tcp_fd; - struct timeval tv; + int n; + struct pollfd p = {url_get_file_handle(rt->rtsp_hd), POLLIN, 0}; AVFormatContext *rtpctx; int ret; - tcp_fd = url_get_file_handle(rt->rtsp_hd); - while (1) { - FD_ZERO(&rfds); - FD_SET(tcp_fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - n = select(tcp_fd + 1, &rfds, NULL, NULL, &tv); + n = poll(&p, 1, 0); if (n <= 0) break; - if (FD_ISSET(tcp_fd, &rfds)) { + if (p.revents & POLLIN) { RTSPMessageHeader reply; /* Don't let ff_rtsp_read_reply handle interleaved packets, |