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>
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 */
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;
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;
fast_retries = FFMAX(fast_retries, 2);
len += ret;
if (url_interrupt_cb())
- return AVERROR(EINTR);
+ return AVERROR_EXIT;
}
return len;
}
/**
* 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.
*/
#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) {
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;
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) &&
/* 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);
for(;;) {
if (url_interrupt_cb())
- return AVERROR(EINTR);
+ return AVERROR_EXIT;
ret = poll(&p, 1, 100);
if (ret < 0) {
if (ff_neterrno() == AVERROR(EINTR))
read_size = 0;
for(;;) {
if(url_interrupt_cb()){
- ret= AVERROR(EINTR);
+ ret= AVERROR_EXIT;
av_log(ic, AV_LOG_DEBUG, "interrupted\n");
break;
}