-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Cache Section #941
Media Cache Section #941
Conversation
Hi @WolfWhisperer .. thanks for the info. I haven't forgotten about this, but some very quick points/questions
tl;dr: I'll get back to this at some stage :) |
That was deliberate. In PB mode and when using Kibibytes: For
For Why I think all the prefs are needed: As for |
me
I clearly need moar coffee, lol. We actual force (more) memory cache (by disabling disk) - and this discussion is all about memory cache and how to use/improve that |
going to @earthlng here for his opinions
|
@WolfWhisperer thanks for all those very detailed infos! In your paragraph about "private browsing mode"+forceMediaMemoryCache you write that
but that's not what I'm seeing. To test it I already had forceMediaMemoryCache enabled, then set the memory_cache_max_size to 10x default and reduced I tested another video (which seems to send the whole video unchunked, with a Content-Length of 460875880) with the same config and that works fine too. If we're indeed breaking certain videos in private windows due to the recently added forceMediaMemoryCache pref then that's definitely something we should warn users about but I'm not able to confirm that we actually are. |
I checked again, and I'm still seeing the videos not load at all, including the link you provided. I'm using FF 76.0, are you too? I tried seeing if certain other prefs might be influencing what's going on to no avail. Tomorrow I'll set up a vanilla FF installation on another system and see what I can come up with. |
All the videos here are working flawlessly in a plain vanilla firefox profile + ghacks user.js What is your Internet connection bandwidth? Speedtest? Firefox 76.0.1 (64-bit) Cheers |
yes
Since we know that parts of a media object are evicted as needed, and since by default it only uses a very small media cache anyways (ie. much smaller than either of the combined_limit prefs on almost all systems, presumably), I don't see why a media object shouldn't load when it's larger than either of the combined_limit prefs. @crssi, did you set |
In this case the video stutters. |
Thanks @crssi yeah the stuttering is probably because the media cache is too small. We'll likely increase that soon. @WolfWhisperer videos not loading at all seems to be caused by something on your end. We're now 2 people who can't replicate that issue. |
@earthlng Do we want to fixup the kibibytes info and up the cache size etc for 78, given it's an ESR release. It doesn't have to hold up 78-beta, but the time til 78 final is not far off either. |
yeah we can do that |
problems with forceMediaMemoryCache (ie videos not loading) could be this (fixed in FF80). I committed the kibibytes fixup. What do you want to up the cache to? 5x default? 10x default? |
WolfWhisperer said
I think we do either 4x or 8x: since this user.js is aimed at desktop, we should be fine with 64 - I'll do a commit @earthlng Was there anything else in this PR you wanted? |
No, I think it's too much and most people wouldn't know what to do with it. |
FYI: https://bugzilla.mozilla.org/show_bug.cgi?id=1650281 - fixed in FF80
|
I linked to that ticket on August 3rd (see above). They added this pref specifically for TB so I'd hope that they'll backport that patch to ESR78. But yes, until they do that I think it's probably worth mentioning for ESR78 users. |
OK, I'll add it to the other patch |
Hello. I've been using your excellent user.js to customize my Firefox, and I'm pleased to finally offer back a contribution. I tested lots of variations on these settings in different situations, plus looked into the source code, to arrive at these findings. I used large video files because it's easy to observe what FF does with a large chunk of data.
The media cache is separate from the main cache. It it used instead of the main cache for HTML5-style media objects such as
<video>
, and only keeps them in cache while the objects are open (i.e. navigating away to another page or closing the tab removes the objects from cache.) The media cache is primarily a disk-based cache, having been originally coded that way, however a memory-based media cache was added later and will be used instead if certain conditions are met. Only one cache type is used per media object.A media object will be stored in memory instead of disk if the size of the media object is lower than all three of:
media.memory_cache_max_size
(in KiB; default 8,192)media.memory_caches_combined_limit_kb
(in KiB, default 524,288)media.memory_caches_combined_limit_pc_sysmem
(in percent of system memory; default 5)The two combined_limit prefs appear to be intended to limit the combined size of all the media objects in memory cache, but they don't do that.
If memory cache is not used, disk cache is used instead. The size of the disk cache is controlled by:
media.cache_size
(in KiB; default 512,000)The disk cache can't be disabled by setting this to 0. In that case, FF still uses a disk cache, but it is small (~12 MB) and playback may be impacted as a result.
While in private browsing mode, and while
browser.privatebrowsing.forceMediaMemoryCache
is set to true, disk cache is never used. In this case, the memory cache is used even if the media object is larger thanmedia.memory_cache_max_size
. The available memory cache is used, with parts of the object evicted as needed to stay within the limit (of a single object; combined memory cache size is still not limited). The default memory cache limit of 8 MiB is not adequate for high bitrate videos; playback will be impacted because the buffer is too small. If the media object is larger than either of the combined_limit prefs, it will not load at all.I decided to set my limits to 3 GiB, 3 GiB and 50% because I want FF to use memory instead of disk whenever possible, and I have plenty of RAM. That's why I included the two combined_limit prefs -- they also need to be increased if a user wants to be able to use memory for large media objects.
Some large videos I used for testing (note: navigating directly to the videos, or accessing them as