[MPlayer-dev-eng] Re: Prefetching/buffering files

Jan Knutar jknutar at nic.fi
Fri Sep 2 22:19:04 CEST 2005


On Friday 02 September 2005 23:01, Anil Nambiar wrote:

> What I understood from the code is that when -cache is enabled, it forks 
> another process x, which does the read of the media playing. But that data is 
> not used directly by demux.

I think you are wrong here.

> But since the process x has read the data which  
> demux needed, it might be in the cache of the network or file system layer and 
> is read from the cache instead of the media. Correct me if my understanding or -
> cache is wrong. 

I believe cache reads into a shared memory area, from which the original process
then reads from.


> So for reading from nfs, it does a good job, while reading from hdd,

If it would indeed work as you describe, I think that it would do a very poor job,
because playing back a typical file that is bigger than physical memory, the
read requirement would be about 1500kbits/sec, but the harddrive can provide
30 megabytes/sec. On my system the read rate stays consistent throughout,
thus the cache can't be reading aimlessly, and by observing the memory usage
of mplayer in top, I must conclude that mplayer is infact caching the file itself.

> it doesn't  
> work so well. In fact it slows down due to the extra process x, that is running.

Yes, the extra overhead from the extra process might slow things down, especially
on borderline systems. This is why lots of developers are against threading, and why
cache is disabled by default, as to be as fast as possible in the most common situations.

But it still sounds a bit strange that you are getting significantly less performance
enabling cache for local storage.




More information about the MPlayer-dev-eng mailing list