summaryrefslogtreecommitdiffstats
path: root/stream/cache2.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-11-10 17:21:28 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-14 12:24:11 +0200
commit0792847d4aeca71c0e61d47a9734d192506f1249 (patch)
tree4c88895bc35b3a76d679e8901b16141ab5d4d68e /stream/cache2.c
parentb2c09ad9a4c6df34a7ce5b5cffc134b36983093d (diff)
downloadmpv-0792847d4aeca71c0e61d47a9734d192506f1249.tar.bz2
mpv-0792847d4aeca71c0e61d47a9734d192506f1249.tar.xz
cache: read up to 64 KiB at once from stream_file
Make the file protocol read up to 64 KiB at once when the cache is used, assuming that files will generally be readable with high bandwidth. This should improve performance when playing e.g. from high-latency network shares. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32616 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/cache2.c')
-rw-r--r--stream/cache2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/stream/cache2.c b/stream/cache2.c
index d7a8005917..2785a0c60f 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -39,6 +39,7 @@
#include <unistd.h>
#include <errno.h>
+#include "libavutil/avutil.h"
#include "osdep/shmem.h"
#include "osdep/timer.h"
#if defined(__MINGW32__)
@@ -168,6 +169,7 @@ static int cache_fill(cache_vars_t *s)
{
int back,back2,newb,space,len,pos;
off_t read=s->read_filepos;
+ int read_chunk;
if(read<s->min_filepos || read>s->max_filepos){
// seek...
@@ -213,7 +215,9 @@ static int cache_fill(cache_vars_t *s)
if(space>s->buffer_size-pos) space=s->buffer_size-pos;
// limit one-time block size
- if(space>4*s->sector_size) space=4*s->sector_size;
+ read_chunk = s->stream->read_chunk;
+ if (!read_chunk) read_chunk = 4*s->sector_size;
+ space = FFMIN(space, read_chunk);
#if 1
// back+newb+space <= buffer_size