| Summary: | ManagedMediaSource content should be evicted whenever it is under memory pressure | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Component: | Media | Assignee: | 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: | |||
Pull request: https://github.com/WebKit/WebKit/pull/10708 Committed 260871@main (fee371950f62): <https://commits.webkit.org/260871@main> Reviewed commits have been landed. Closing PR #10708 and removing active labels. 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
Re-opened since this is blocked by bug 253004 Pull request: https://github.com/WebKit/WebKit/pull/10774 Committed 260920@main (98b2a211bb53): <https://commits.webkit.org/260920@main> Reviewed commits have been landed. Closing PR #10774 and removing active labels. |
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