Commit 90e495e4 authored by mstorsjo's avatar mstorsjo

Check url_interrupt_cb in rtp_read, wait in select for max 100 ms before...

Check url_interrupt_cb in rtp_read, wait in select for max 100 ms before rechecking url_interrupt_cb


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22209 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 0ab4bc57
...@@ -193,6 +193,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) ...@@ -193,6 +193,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
socklen_t from_len; socklen_t from_len;
int len, fd_max, n; int len, fd_max, n;
fd_set rfds; fd_set rfds;
struct timeval tv;
#if 0 #if 0
for(;;) { for(;;) {
from_len = sizeof(from); from_len = sizeof(from);
...@@ -208,6 +209,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) ...@@ -208,6 +209,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
} }
#else #else
for(;;) { for(;;) {
if (url_interrupt_cb())
return AVERROR(EINTR);
/* build fdset to listen to RTP and RTCP packets */ /* build fdset to listen to RTP and RTCP packets */
FD_ZERO(&rfds); FD_ZERO(&rfds);
fd_max = s->rtp_fd; fd_max = s->rtp_fd;
...@@ -215,7 +218,9 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) ...@@ -215,7 +218,9 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size)
if (s->rtcp_fd > fd_max) if (s->rtcp_fd > fd_max)
fd_max = s->rtcp_fd; fd_max = s->rtcp_fd;
FD_SET(s->rtcp_fd, &rfds); 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) { if (n > 0) {
/* first try RTCP */ /* first try RTCP */
if (FD_ISSET(s->rtcp_fd, &rfds)) { if (FD_ISSET(s->rtcp_fd, &rfds)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment