diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2011-03-13 02:42:27 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-15 15:09:19 +0300 |
commit | c76374c6db5f486672f9df223f43e4892bd655c9 (patch) | |
tree | 224beb5c4770ae0f10ffab26ec44f9bd1cc995e9 /libavformat | |
parent | bafa4dd3e69531f262472ac286e0ae7d4dbfbd97 (diff) |
Use AVERROR_EXIT with url_interrupt_cb.
Functions interrupted by url_interrupt_cb should not be restarted.
Therefore using AVERROR(EINTR) was wrong, as it did not allow to distinguish
when the underlying system call was interrupted and actually needed to be
restarted.
This fixes roundup issues 2657 and 2659 (ffplay not exiting for streamed
content).
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/applehttp.c | 2 | ||||
-rw-r--r-- | libavformat/applehttpproto.c | 4 | ||||
-rw-r--r-- | libavformat/avio.c | 2 | ||||
-rw-r--r-- | libavformat/avio.h | 2 | ||||
-rw-r--r-- | libavformat/rtpproto.c | 2 | ||||
-rw-r--r-- | libavformat/rtsp.c | 2 | ||||
-rw-r--r-- | libavformat/tcp.c | 6 | ||||
-rw-r--r-- | libavformat/udp.c | 2 | ||||
-rw-r--r-- | libavformat/utils.c | 2 |
9 files changed, 13 insertions, 11 deletions
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c index c1609b895d..7a3d8b0b10 100644 --- a/libavformat/applehttp.c +++ b/libavformat/applehttp.c @@ -528,7 +528,7 @@ reload: return AVERROR_EOF; while (av_gettime() - c->last_load_time < c->target_duration*1000000) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; usleep(100*1000); } /* Enough time has elapsed since the last reload */ diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 83071300e8..871f2712df 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -318,7 +318,7 @@ retry: return AVERROR_EOF; while (av_gettime() - s->last_load_time < s->target_duration*1000000) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; usleep(100*1000); } goto retry; @@ -328,7 +328,7 @@ retry: ret = url_open(&s->seg_hd, url, URL_RDONLY); if (ret < 0) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; av_log(NULL, AV_LOG_WARNING, "Unable to open %s\n", url); s->cur_seq_no++; goto retry; diff --git a/libavformat/avio.c b/libavformat/avio.c index 2265549266..5dca68a50c 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -238,7 +238,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int fast_retries = FFMAX(fast_retries, 2); len += ret; if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; } return len; } diff --git a/libavformat/avio.h b/libavformat/avio.h index b8f9c588cc..761ced6aa1 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -237,7 +237,7 @@ void url_get_filename(URLContext *h, char *buf, int buf_size); /** * The callback is called in blocking functions to test regulary if - * asynchronous interruption is needed. AVERROR(EINTR) is returned + * asynchronous interruption is needed. AVERROR_EXIT is returned * in this case by the interrupted function. 'NULL' means no interrupt * callback is given. */ diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 269b1b2726..bca8ab648b 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -241,7 +241,7 @@ static int rtp_read(URLContext *h, uint8_t *buf, int size) #else for(;;) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; /* build fdset to listen to RTP and RTCP packets */ n = poll(p, 2, 100); if (n > 0) { diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index a24f12bacf..f50650ed8f 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1565,7 +1565,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st, for (;;) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; if (wait_end && wait_end - av_gettime() < 0) return AVERROR(EAGAIN); max_p = 0; diff --git a/libavformat/tcp.c b/libavformat/tcp.c index b01f0b85bf..83529dfcc4 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -73,8 +73,10 @@ static int tcp_open(URLContext *h, const char *uri, int flags) if (ret < 0) { struct pollfd p = {fd, POLLOUT, 0}; if (ff_neterrno() == AVERROR(EINTR)) { - if (url_interrupt_cb()) + if (url_interrupt_cb()) { + ret = AVERROR_EXIT; goto fail1; + } goto redo; } if (ff_neterrno() != AVERROR(EINPROGRESS) && @@ -84,7 +86,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags) /* wait until we are connected or until abort */ for(;;) { if (url_interrupt_cb()) { - ret = AVERROR(EINTR); + ret = AVERROR_EXIT; goto fail1; } ret = poll(&p, 1, 100); diff --git a/libavformat/udp.c b/libavformat/udp.c index 0196573209..76a0f35099 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -452,7 +452,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) for(;;) { if (url_interrupt_cb()) - return AVERROR(EINTR); + return AVERROR_EXIT; ret = poll(&p, 1, 100); if (ret < 0) { if (ff_neterrno() == AVERROR(EINTR)) diff --git a/libavformat/utils.c b/libavformat/utils.c index 902a170b53..1dfaa3caf3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2267,7 +2267,7 @@ int av_find_stream_info(AVFormatContext *ic) read_size = 0; for(;;) { if(url_interrupt_cb()){ - ret= AVERROR(EINTR); + ret= AVERROR_EXIT; av_log(ic, AV_LOG_DEBUG, "interrupted\n"); break; } |