aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtspenc.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2011-01-28 03:12:21 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-01-30 03:40:59 +0100
commitd0eb91ad0451cdb6c062b2d4760bfa7f8bb4db6b (patch)
treeaad8df0b1a480fbcdcae278fe393f287106d76d3 /libavformat/rtspenc.c
parentb5f83debf5384195c8700d024fb760ab8d7250aa (diff)
downloadffmpeg-d0eb91ad0451cdb6c062b2d4760bfa7f8bb4db6b.tar.gz
os: replace select with poll
Select has limitations on the fd values it could accept and silently breaks when it is reached. (cherry picked from commit a8475bbdb64e638bd8161df9647876fd23f8a29a)
Diffstat (limited to 'libavformat/rtspenc.c')
-rw-r--r--libavformat/rtspenc.c19
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,