summaryrefslogtreecommitdiffstats
path: root/libmpdemux/cache2.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-13 03:08:56 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-01-13 03:08:56 +0000
commita1299f067ae71e6e7b96bccd14b414a371252f98 (patch)
tree4e32ee17f5aaa287ab036d2a68da412ec8a46654 /libmpdemux/cache2.c
parent1e166db2028c0f27ea32d3c9427f993cc24d85ce (diff)
downloadmpv-a1299f067ae71e6e7b96bccd14b414a371252f98.tar.bz2
mpv-a1299f067ae71e6e7b96bccd14b414a371252f98.tar.xz
do not discard cache content at seeking type=STREAMTYPE_STREAM
(fixes quicktime streaming at low cache fill) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8939 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/cache2.c')
-rw-r--r--libmpdemux/cache2.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libmpdemux/cache2.c b/libmpdemux/cache2.c
index d2db6afe6c..be874f88b3 100644
--- a/libmpdemux/cache2.c
+++ b/libmpdemux/cache2.c
@@ -113,11 +113,16 @@ int cache_fill(cache_vars_t* s){
if(read<s->min_filepos || read>s->max_filepos){
// seek...
mp_msg(MSGT_CACHE,MSGL_DBG2,"Out of boundaries... seeking to 0x%X \n",read);
- s->offset= // FIXME!?
- s->min_filepos=s->max_filepos=read; // drop cache content :(
- if(s->stream->eof) stream_reset(s->stream);
- stream_seek(s->stream,read);
- mp_msg(MSGT_CACHE,MSGL_DBG2,"Seek done. new pos: 0x%X \n",(int)stream_tell(s->stream));
+ // streaming: drop cache contents only if seeking backward or too much fwd:
+ if(s->stream->type!=STREAMTYPE_STREAM ||
+ read<s->min_filepos || read>=s->max_filepos+s->buffer_size)
+ {
+ s->offset= // FIXME!?
+ s->min_filepos=s->max_filepos=read; // drop cache content :(
+ if(s->stream->eof) stream_reset(s->stream);
+ stream_seek(s->stream,read);
+ mp_msg(MSGT_CACHE,MSGL_DBG2,"Seek done. new pos: 0x%X \n",(int)stream_tell(s->stream));
+ }
}
// calc number of back-bytes: