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>
This commit is contained in:
Daniel Kucera
2017-10-17 10:29:30 +02:00
committed by Nicolas George
parent f4090940bd
commit 858db4b01f
5 changed files with 27 additions and 17 deletions

View File

@@ -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;
}