summaryrefslogtreecommitdiff
path: root/libavformat/cache.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-16 16:54:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-16 17:12:37 +0200
commit02b651a7e39844edd573a9d057ec87a0160bef8d (patch)
treedceb35c5dcc4cca843c1d172fcc6fef058b56457 /libavformat/cache.c
parente9f62a8b2bb7f675d21dace520e62c55bc8996a9 (diff)
cache: Fallback to using the cache size for AVSEEK_SIZE if the underlaying protocol has nothing better.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/cache.c')
-rw-r--r--libavformat/cache.c9
1 files changed, 8 insertions, 1 deletions
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);