diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-01 11:47:35 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-01 11:47:42 +0200 |
commit | d2c613dd1460a34ca166550d5d9d8cdd5cf278df (patch) | |
tree | 905ae19fbbe79b69367b68e8e351232f17d47041 /libavformat/rtpproto.c | |
parent | 57b8ce414be574a772d386f57afa502eac072085 (diff) | |
parent | 54e03ff6af8a070f1055edd26028f3f7b2e2ca8e (diff) | |
download | ffmpeg-d2c613dd1460a34ca166550d5d9d8cdd5cf278df.tar.gz |
Merge commit '54e03ff6af8a070f1055edd26028f3f7b2e2ca8e'
* commit '54e03ff6af8a070f1055edd26028f3f7b2e2ca8e':
rtpproto: Support nonblocking reads
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpproto.c')
-rw-r--r-- | libavformat/rtpproto.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index d398b9cf3b..6b28f84f2e 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -327,12 +327,13 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) socklen_t from_len; int len, n; struct pollfd p[2] = {{s->rtp_fd, POLLIN, 0}, {s->rtcp_fd, POLLIN, 0}}; + int poll_delay = h->flags & AVIO_FLAG_NONBLOCK ? 0 : 100; for(;;) { if (ff_check_interrupt(&h->interrupt_callback)) return AVERROR_EXIT; /* build fdset to listen to RTP and RTCP packets */ - n = poll(p, 2, 100); + n = poll(p, 2, poll_delay); if (n > 0) { /* first try RTCP */ if (p[1].revents & POLLIN) { @@ -369,6 +370,8 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) continue; return AVERROR(EIO); } + if (h->flags & AVIO_FLAG_NONBLOCK) + return AVERROR(EAGAIN); } return len; } |