aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avio.c
diff options
context:
space:
mode:
authorDaniel Kucera <daniel.kucera@gmail.com>2017-10-17 10:29:30 +0200
committerNicolas George <george@nsup.org>2017-10-19 22:07:21 +0200
commit858db4b01fa2b55ee55056c033054ca54ac9b0fd (patch)
tree5a29252c4545b4ff80bb0beead0628812d0b73b9 /libavformat/avio.c
parentf4090940bd3024e69d236257d327f11d1e496229 (diff)
downloadffmpeg-858db4b01fa2b55ee55056c033054ca54ac9b0fd.tar.gz
libavformat: not treat 0 as EOF
transfer_func variable passed to retry_transfer_wrapper are h->prot->url_read and h->prot->url_write functions. These need to return EOF or other error properly. In case of returning >= 0, url_read/url_write is retried until error is returned. Signed-off-by: Daniel Kucera <daniel.kucera@gmail.com>
Diffstat (limited to 'libavformat/avio.c')
-rw-r--r--libavformat/avio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 64248e098b..4718753b7b 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -391,8 +391,10 @@ static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
}
av_usleep(1000);
}
- } else if (ret < 1)
- return (ret < 0 && ret != AVERROR_EOF) ? ret : len;
+ } else if (ret == AVERROR_EOF)
+ return (len > 0) ? len : AVERROR_EOF;
+ else if (ret < 0)
+ return ret;
if (ret) {
fast_retries = FFMAX(fast_retries, 2);
wait_since = 0;