Handle MediaCache more elegantly in multi-process Firefox

NEW
Unassigned

Status

()

4 years ago
2 years ago

People

(Reporter: cpearce, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
Currently each Firefox process gets it own MediaCache to store downloaded media data. On B2G this is 40MB, on desktop Firefox its 512MB. In multi-process Gecko, each content-process gets its own MediaCache. So if you have 10 tabs in desktop Firefox playing video, you could end up with 5120MB of data buffered on disk.

We need a more ideal solution. Either we need to remote all MediaCache operations to the parent process, or we need the MediaCache instances in content processes to talk to each other to ensure the space used on disk remains under control.
IIRC, IPC calls run on the main thread. For performance concern, I would prefer to centralize the storage limit rather than the storage itself.
(Reporter)

Comment 2

4 years ago
(In reply to JW Wang [:jwwang] from comment #1)
> IIRC, IPC calls run on the main thread.

IPC can be received the off main thread; Gecko Media Plugins send and receive their IPC on a non-main thread. I don't know if the IPC is routed through the main thread first however.

> For performance concern, I would
> prefer to centralize the storage limit rather than the storage itself.

This would reduce the amount of data we're copying between processes, so I agree it would probably perform better.
(In reply to Chris Pearce (:cpearce) from comment #0)
> Currently each Firefox process gets it own MediaCache to store downloaded
> media data. On B2G this is 40MB, 

on b2g, it is set to 4mb.
http://mxr.mozilla.org/mozilla-central/source/b2g/app/b2g.js#320
If we want to improve the performance of media cache, Bug 1013756 might be related.
(In reply to JW Wang [:jwwang] from comment #1)
> IIRC, IPC calls run on the main thread. For performance concern, I would
> prefer to centralize the storage limit rather than the storage itself.

We want to share cached data between tabs. However IPC traffic introduces propagation delays.
IPC does by default run on the main thread, but PBackground can be used to do IPC between two processes w/o involving the main thread in either process.
Component: Audio/Video → Audio/Video: Playback
You need to log in before you can comment on or make changes to this bug.