Consider improving the heuristics used by MSE garbage collection algorithm |
|
Issue descriptionThere is a separate bug for making the MSE GC algorithm more aggressive based on memory pressure notifications (crbug.com/811464). But memory pressure notifications could be unreliable or even unavailable on some platforms. I think there are some improvements that Chromium could make even without waiting for memory pressure notifications to be implemented on various platforms. AFAIR the default MSE garbage collection algorithm is unnecessarily lazy - it only starts evicting data when the buffered data size exceeds buffering limits (150MB for video, 12MB for audio). So an HTMLMediaElement playing through MSE will consume ~162MB of memory, assuming the media stream is long enough (if you take a look at the demuxer memory usage UMA diagram, it's easy to notice the spike in the 156MB-177MB bucket - more than 6% of all playbacks) - and most of that is stale buffered data far behind the playback position. We could modify the GC algorithm, for example, to evict all data that is more than X seconds past the current playback position (I believe a reasonable range for X could be ~10-30 sec, but we could determine the optimal value by running some additional experiments). I believe if we did that we'd see a very significant reduction in the 156MB-177MB bucket UMA bucket. Dale/Dan, WDYT - worth running an experiment like that first, while we sort things out with memory pressure signals?
,
Jun 21 2018
Well, of course I realize that people do seek backwards occasionally, that's why I proposed evicting all data older than <playback position> - X seconds, instead of blindly discarding all data up to the GOP containing the current playback position. I suspect (although don't have any hard data on this), that most seeks backwards are within ~30 sec of the current playback position. Yet currently we can be holding much more data in the sourcebuffer. So I was just wondering if we could run some experiments, gather some data on how far back seeking usually happens, and if let's say 90% of seeking happens within 30 sec of the current playback position, wouldn't it be worth it to evict the stale data outside that range and save some memory? I realize this might now seem like much, but on Android phones with 2-4GB of memory it could give us significant savings.
,
Jun 21 2018
I suspect seek behavior is content dependent, so I'm wary of doing something like that for all of Chrome. I'd be fine with adding metrics to try to quantify seek behavior though. The fact that only ~6% of all playbacks are near the peak indicates most sites are already doing a good job of managing their own source buffer limits. Which indicates that we'd likely see limited value in proactively collecting data based on some criteria other than memory pressure. |
|
►
Sign in to add a comment |
|
Comment 1 by dalecur...@chromium.org
, Jun 20 2018