Bug 252938

Summary: ManagedMediaSource content should be evicted whenever it is under memory pressure
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=252957
Bug Depends on: 253004    
Bug Blocks:    

Jean-Yves Avenard [:jya]
Reported 2023-02-24 17:26:19 PST
Right now, the decision to act on a media element following a memory pressure event is left to the WebProcess' MemoryPressureHandler which is set in `WebProcess::initializeWebProcess` which ends up calling `releaseCriticalMemory` [1] through the loop: ``` #if ENABLE(VIDEO) for (auto* mediaElement : HTMLMediaElement::allMediaElements()) { if (mediaElement->paused()) mediaElement->purgeBufferedDataIfPossible(); } #endif ``` The eviction of data in a ManagedMediaSource is designed to allow the media element to continue being playable, we do not have to wait for it to be paused. And it should be up to the MediaElement itself to determine of data should be purged or not anyway. [1] https://searchfox.org/wubkat/source/Source/WebCore/page/MemoryRelease.cpp#118-123
Attachments
Radar WebKit Bug Importer
Comment 1 2023-02-24 17:26:41 PST
Jean-Yves Avenard [:jya]
Comment 2 2023-02-26 17:14:04 PST
EWS
Comment 3 2023-02-27 02:59:11 PST
Committed 260871@main (fee371950f62): <https://commits.webkit.org/260871@main> Reviewed commits have been landed. Closing PR #10708 and removing active labels.
Ryan Haddad
Comment 4 2023-02-27 10:18:14 PST
This change caused TestWebKitAPI.WebKit.MediaBufferingPolicy to consistently fail on macOS bots: TestWebKitAPI.WebKit.MediaBufferingPolicy /Volumes/Data/worker/Apple-Ventura-Release-Build/build/Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaBufferingPolicy.mm:47 Expected equality of these values: expected Which is: "PurgeResources" observed Which is: "LimitReadAhead" https://build.webkit.org/#/builders/702/builds/1684/steps/19/logs/stdio https://results.webkit.org/?suite=api-tests&test=TestWebKitAPI.WebKit.MediaBufferingPolicy
WebKit Commit Bot
Comment 5 2023-02-27 10:20:03 PST
Re-opened since this is blocked by bug 253004
Jean-Yves Avenard [:jya]
Comment 6 2023-02-27 18:54:21 PST
EWS
Comment 7 2023-02-27 20:13:52 PST
Committed 260920@main (98b2a211bb53): <https://commits.webkit.org/260920@main> Reviewed commits have been landed. Closing PR #10774 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.