Bug 265079

Summary: [GPUP][MSE] RemoteSourceBufferProxy::EvictCodedFrames shouldn't be a sync call
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: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 226632    

Description Jean-Yves Avenard [:jya] 2023-11-17 22:39:11 PST
The MSE spec requires the Prepare Append [1] algorithm to run synchronously at the start of appendBuffer [2]

Part of this algorithm is the Coded Frames Eviction [3] algorithm. 
With the GPU Process this is a sync dispatch, and is problematic as it can be run at any time and not waiting for any pending SourceBufferPrivate operations to complete.

Currently, the only need for this call to be synchronous is to determine how much data is evictable from the SourceBuffers/TrackBuffers ; we could instead calculate this value after each SourceBuffer operation and update it as time progresses. This information would be sent at regular interval back to the content process, so that the next time the Prepare Append Algorithm is run in the Content Process, it already approximately knows how much data is evictable.
The information doesn't need to be 100% accurate, it just needs to be accurate enough so that on average the buffered size is below the limit.

[1] https://w3c.github.io/media-source/#sourcebuffer-prepare-append
[2] https://w3c.github.io/media-source/#dom-sourcebuffer-appendbuffer
[3] https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
Comment 1 Radar WebKit Bug Importer 2023-11-24 22:40:15 PST
<rdar://problem/118783504>
Comment 2 Jean-Yves Avenard [:jya] 2024-02-26 01:35:35 PST
Pull request: https://github.com/WebKit/WebKit/pull/25092
Comment 3 EWS 2024-02-27 06:30:51 PST
Committed 275380@main (bbf768df7ba7): <https://commits.webkit.org/275380@main>

Reviewed commits have been landed. Closing PR #25092 and removing active labels.