summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmpdemux/cache2.c7
-rw-r--r--libmpdemux/stream.h2
2 files changed, 5 insertions, 4 deletions
diff --git a/libmpdemux/cache2.c b/libmpdemux/cache2.c
index 09170f8073..8e935a6c06 100644
--- a/libmpdemux/cache2.c
+++ b/libmpdemux/cache2.c
@@ -194,9 +194,8 @@ static void exit_sighandler(int x){
exit(0);
}
-void stream_enable_cache(stream_t *stream,int size,float prefill_init,float prefill){
+void stream_enable_cache(stream_t *stream,int size,int min,int prefill){
int ss=(stream->type==STREAMTYPE_VCD)?VCD_SECTOR_DATA:STREAM_BUFFER_SIZE;
- int min=prefill_init*size;
cache_vars_t* s=cache_init(size,ss);
stream->cache_data=s;
s->stream=stream; // callback
@@ -204,9 +203,11 @@ void stream_enable_cache(stream_t *stream,int size,float prefill_init,float pref
if((stream->cache_pid=fork())){
// wait until cache is filled at least prefill_init %
+ printf("CACHE_PRE_INIT: %d [%d] %d pre:%d eof:%d \n",
+ s->min_filepos,s->read_filepos,s->max_filepos,min,s->eof);
while(s->read_filepos<s->min_filepos || s->max_filepos-s->read_filepos<min){
mp_msg(MSGT_CACHE,MSGL_STATUS,"\rCache fill: %5.2f%% (%d bytes) ",
- (float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
+ 100.0*(float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
s->max_filepos-s->read_filepos
);
if(s->eof) break; // file is smaller than prefill size
diff --git a/libmpdemux/stream.h b/libmpdemux/stream.h
index 3af906337a..184444971b 100644
--- a/libmpdemux/stream.h
+++ b/libmpdemux/stream.h
@@ -42,7 +42,7 @@ typedef struct {
} stream_t;
#ifdef USE_STREAM_CACHE
-void stream_enable_cache(stream_t *stream,int size,float prefill_init,float prefill);
+void stream_enable_cache(stream_t *stream,int size,int min,int prefill);
#else
// no cache
#define cache_stream_fill_buffer(x) stream_fill_buffer(x)