Some help with cache on RPi3 advancedsettings

howdy fellows… So I was introduced to the wonder of advancedsettings.xml during one of my queries regarding ac wifi adapter. I initially had the below settings.

       <memorysize>157286400</memorysize>
        <buffermode>1</buffermode>
        <readfactor>4.0</readfactor>

However on a couple of occasions the Pi got very low on RAM that the playback started to stutter and once it gave up and crashed. So I reduced the memory size to 100MB from 150 MB.

now the playback or crashing is gone but on every single stream I encounter at least 3 to 4 buffering delays.

My setup:
RPi3 on ethernet. The above was for internet streams, couldn’t test a local NAS stream yet. Besides OSMC, I have got hyperion running as well. Got a couple of addons that cannot be named :wink:

  1. Will increasing the readfactor help in speeding up the buffering? (if it takes 1 min now, wil it reduce it to say 15 secs). I don’t run anything else out of the Pi so I don’t care if this uses up all the bandwidth.

  2. Is it normal for a Pi3 to exhaust all its RAM if set to 150MB of cache? (i.e 298 MB of free RAM)

  3. GPU is set to 256 MB RAM, is it advisable to set it to a lower value and recover some RAM?

  4. Before anyone else says that something is leaking RAM, what logs would help to find the culprit?

https://kodi.wiki/view/HOW-TO:Modify_the_cache
Based on the article you need 3 times the ram that you specific as value so would be clear that you run out of memory.
While the need for 3 times memory had been discussed here earlier and is not confirmed

Yep, I am aware of that and hence the 298 MB free RAM (748-(150*3)). But I ran out of RAM only when I was streaming a 1080P link which appeared to be of a high bitrate. Anywho I am okay with a 100MB for cache, any idea on question 1?

No, higher number mean cache initially filled more = slower start

hmm… so what would make my interim buffering take less time? I am okay if the initial start is delayed but it is the interim buffering and the time it takes to resume that drives me mad.

Well if the cache runs dry it starts to fill like original. So lower value most likely will mean more buffering interruptions but for shorter period (it’s a catch 22)

@fzinken just so we are clear, are we talking about the cache size or the readfactor? My Q1 was regarding the readfactor value.

Talking about readfactor. The readfactor determines how much of the Cache is filled before video starts.

thanks mate. I’ll muck around a bit with the values and see if anything else.

The actual cache memory used is 50% of whatever memorysize you specify allocated to video and a smaller amount allocated to audio. Of the 50% allocated to video, three quarters is used for read-ahead caching, with the rest presumably for skipping backwards. (Based on reading the code.)

On the basis of experiments I performed a few months ago, I’d recommend a readfactor closer to 16, since that seems to perform better with higher-bitrate videos.

On my setup i have memorysize setted to 200MB… buffermode 1… and readfactor and 1.5.

On my setup i have also tryed, in the pass, to raise the memorysize to 500MB and also, in the pass, i have also tryed to use value like 99 for readfactor but i’m now know one thigs:
Nothigs of that can really help if you obtain buffering problems :slight_smile:

From about one months… i have also setup a 130Mbps Fiber and my Pi2 it’s connected directed by LAN to router but nothigs resolve… if you obtain buffering… buffering still :slight_smile: