From a8475bbdb64e638bd8161df9647876fd23f8a29a Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 28 Jan 2011 03:12:21 +0100 Subject: os: replace select with poll Select has limitations on the fd values it could accept and silently breaks when it is reached. --- libavformat/rtspenc.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'libavformat/rtspenc.c') 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 -#if HAVE_SYS_SELECT_H -#include +#if HAVE_POLL_H +#include #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, -- cgit v1.2.3