diff --git a/libavformat/cache.c b/libavformat/cache.c index bbc85925c2..c08250b187 100644 --- a/libavformat/cache.c +++ b/libavformat/cache.c @@ -95,7 +95,14 @@ static int64_t cache_seek(URLContext *h, int64_t pos, int whence) Context *c= h->priv_data; if (whence == AVSEEK_SIZE) { - return ffurl_seek(c->inner, pos, whence); + pos= ffurl_seek(c->inner, pos, whence); + if(pos <= 0){ + pos= ffurl_seek(c->inner, -1, SEEK_END); + ffurl_seek(c->inner, c->end, SEEK_SET); + if(pos <= 0) + return c->end; + } + return pos; } pos= lseek(c->fd, pos, whence);