---
 libavformat/rtpproto.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 2d2d119..8fc6ce7 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -335,12 +335,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) {
@@ -377,6 +378,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;
 }
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to