summaryrefslogtreecommitdiff
path: root/libavformat/cache.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/cache.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/cache.c')
-rw-r--r--libavformat/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/cache.c b/libavformat/cache.c
index 6aabca2e78..66bbbf54c9 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -201,7 +201,7 @@ static int cache_read(URLContext *h, unsigned char *buf, int size)
}
r = ffurl_read(c->inner, buf, size);
- if (r == 0 && size>0) {
+ if (r == AVERROR_EOF && size>0) {
c->is_true_eof = 1;
av_assert0(c->end >= c->logical_pos);
}
@@ -263,7 +263,7 @@ resolve_eof:
if (whence == SEEK_SET)
size = FFMIN(sizeof(tmp), pos - c->logical_pos);
ret = cache_read(h, tmp, size);
- if (ret == 0 && whence == SEEK_END) {
+ if (ret == AVERROR_EOF && whence == SEEK_END) {
av_assert0(c->is_true_eof);
goto resolve_eof;
}