aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-03-04 15:08:54 +0000
committerMartin Storsjö <martin@martin.st>2010-03-04 15:08:54 +0000
commitc2b40ac229dc4944d391ad949d38efc5822ffcd5 (patch)
treeb447b2b5cfa156a9cc0cd414ac3e78bd5eba8596
parent6c88dc3dbf5a2c796023227b59a963d23801801e (diff)
downloadffmpeg-c2b40ac229dc4944d391ad949d38efc5822ffcd5.tar.gz
Check url_interrupt_cb in rtp_read, wait in select for max 100 ms before rechecking url_interrupt_cb
Originally committed as revision 22209 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/rtpproto.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 6ee711fb31..06bd8bf1ae 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -193,6 +193,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
socklen_t from_len;
int len, fd_max, n;
fd_set rfds;
+ struct timeval tv;
#if 0
for(;;) {
from_len = sizeof(from);
@@ -208,6 +209,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
}
#else
for(;;) {
+ if (url_interrupt_cb())
+ return AVERROR(EINTR);
/* build fdset to listen to RTP and RTCP packets */
FD_ZERO(&rfds);
fd_max = s->rtp_fd;
@@ -215,7 +218,9 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
if (s->rtcp_fd > fd_max)
fd_max = s->rtcp_fd;
FD_SET(s->rtcp_fd, &rfds);
- n = select(fd_max + 1, &rfds, NULL, NULL, NULL);
+ tv.tv_sec = 0;
+ tv.tv_usec = 100 * 1000;
+ n = select(fd_max + 1, &rfds, NULL, NULL, &tv);
if (n > 0) {
/* first try RTCP */
if (FD_ISSET(s->rtcp_fd, &rfds)) {