[Mplayer-cvslog] CVS: main/libmpdemux cache2.c, 1.24, 1.25 demuxer.c, 1.163, 1.164

Ivan Kalvachev CVS syncmail at mplayerhq.hu
Fri Jul 16 22:31:19 CEST 2004


CVS change done by Ivan Kalvachev CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv7668/libmpdemux

Modified Files:
	cache2.c demuxer.c 
Log Message:
cache min fill adjustment, based on patch by Jeremy Huddleston

Index: cache2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/cache2.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- cache2.c	9 Jun 2003 12:15:45 -0000	1.24
+++ cache2.c	16 Jul 2004 20:31:17 -0000	1.25
@@ -198,6 +198,9 @@
 #endif
   memset(s,0,sizeof(cache_vars_t));
   num=size/sector;
+  if(num < 16){
+     num = 16;
+  }//32kb min_size
   s->buffer_size=num*sector;
   s->sector_size=sector;
 #ifndef WIN32
@@ -206,8 +209,7 @@
   s->buffer=malloc(s->buffer_size);
 #endif
   s->fill_limit=8*sector;
-  s->back_size=size/2;
-  s->prefill=size/20; // default: 5%
+  s->back_size=s->buffer_size/2;
   return s;
 }
 
@@ -246,11 +248,20 @@
     return 1;
   }
 
-  if(size<32*1024) size=32*1024; // 32kb min
   s=cache_init(size,ss);
   stream->cache_data=s;
   s->stream=stream; // callback
-  s->prefill=size*prefill;
+  s->prefill=prefill;
+
+
+  //make sure that we won't wait from cache_fill
+  //more data than it is alowed to fill
+  if (s->prefill > s->buffer_size - s->fill_limit ){
+     s->prefill = s->buffer_size - s->fill_limit;
+  }
+  if (min > s->buffer_size - s->fill_limit) {
+     min = s->buffer_size - s->fill_limit;
+  }
   
 #ifndef WIN32  
   if((stream->cache_pid=fork())){

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -r1.163 -r1.164
--- demuxer.c	7 May 2004 08:31:39 -0000	1.163
+++ demuxer.c	16 Jul 2004 20:31:17 -0000	1.164
@@ -1374,6 +1374,9 @@
 
 extern int hr_mp3_seek;
 
+extern float stream_cache_min_percent;
+extern float stream_cache_prefill_percent;
+
 demuxer_t* demux_open(stream_t *vs,int file_format,int audio_id,int video_id,int dvdsub_id,char* filename){
   stream_t *as = NULL,*ss = NULL;
   demuxer_t *vd,*ad = NULL,*sd = NULL;
@@ -1386,8 +1389,8 @@
       return NULL;
     }
     if(audio_stream_cache) {
-      if(!stream_enable_cache(as,audio_stream_cache*1024,audio_stream_cache*1024/5,
-			      audio_stream_cache*1024/20)) {
+      if(!stream_enable_cache(as,audio_stream_cache*1024,audio_stream_cache*1024*(stream_cache_min_percent / 100.0),
+			      audio_stream_cache*1024*(stream_cache_prefill_percent / 100.0))) {
 	free_stream(as);
 	mp_msg(MSGT_DEMUXER,MSGL_ERR,"Can't enable audio stream cache\n");
 	return NULL;




More information about the MPlayer-cvslog mailing list