xbmc/xbmc — pull request #2607 by mtisza (2013-04-12 22:44:47+00:00)
Title: Network Cache Redux

Based on PR 1388 (credit goes to classicspam)

Enhancements to PR 1388:
* Fixed compilation issues due to a change of API in comit: https://github.com/xbmc/xbmc/commit/87047e93e02375851505e9d6c420dd1225996bdb#xbmc/cores/dvdplayer/DVDPlayer.h

Based on PR 831

PR 831 Inclusions (credit goes to bobo1on1):

* Use Free Ram Percentage as Buffer Size
* Adjust Read Rate Based On Max Bitrate

Enhancements to PR 831:

* move variables over to advanced settings under section ("alwaysforcebuffer" default false and "freememorycachepercent" default 50% max 80% with hard limit of 1GB and 0 value will force filecache. It also removes "cachemembuffersize" variable as it is no longer needed)

* "alwaysforcebuffer" variable will cache everything run through dvdplayer (i.e. OS network shares, local media, etc) except Optical Media Drives

* Memory buffer is straight percentage of free ram (i.e. if 50% free ram is used ~75% of the 50% will be forward looking buffer and ~25% of the 50% will be back buffer)

* Rate limiting which fixes SMB issues with PR 831 as far as I can tell (no issues with testing for 1+ months on Windows, Linux and ATV2 devices) (1.25 times max bitrate up to 40 MB/s in which case it is throttled to max bitrate)

* ios and linux fixes

Advanced Settings Notes: This PR adds 2 setting under advanced settings and removes the "cachemembuffersize" setting as it is no longer needed. The added settings are as follows:

* alwaysforcebuffer: This will force everything ran through dvdplayer to be buffered that would not be normal buffered except Optical Media. This includes SMB, Local Files, OS Network Shares, etc. The current default is false due to it not really being a help to people who use hardwired connections (as they probably do not need buffering for SMB, etc).

* "freememorycachepercent": The amount of free memory to use as buffer size. Please note that of the percentage of free memory used ~75% will be used for forward buffering and ~25% will be used for the back buffer. The default is 50% which is a good default for memory limted devices such as the atv2. The max is 80 percent and there is a hard limit of 1GB buffer size irregardless of free ram. Setting it to 0 will force filecaching (same as the way cachemembuffersize was used)