# HG changeset patch # User mstorsjo # Date 1267715334 0 # Node ID 0f9c0db923e5639e558cf1c6d3b61e2c57c332f2 # Parent dfbaca29e6fd6785199d7e040d9ace611b1aaeaf Check url_interrupt_cb in rtp_read, wait in select for max 100 ms before rechecking url_interrupt_cb diff -r dfbaca29e6fd -r 0f9c0db923e5 rtpproto.c --- a/rtpproto.c Thu Mar 04 13:27:53 2010 +0000 +++ b/rtpproto.c Thu Mar 04 15:08:54 2010 +0000 @@ -193,6 +193,7 @@ 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 @@ } #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 @@ 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)) {