RESOLVED FIXED265718
[GPUP] Remove TrackPrivateRemoteIdentifier, fix memory leak
https://bugs.webkit.org/show_bug.cgi?id=265718
Summary [GPUP] Remove TrackPrivateRemoteIdentifier, fix memory leak
Jean-Yves Avenard [:jya]
Reported 2023-12-02 04:57:05 PST
following bug 254099; we are no longer using AtomString as track identifier and as such we no longer need the `TrackPrivateRemoteIdentifier` to bridge the TrackPrivate living in the GPU Process to those in the web content process, instead simply using their TrackID (an uint64_t). While in the process of performing this task, I identify a leak in the `MediaPlayerPrivateRemote` code, which was only partially fixed in bug 242925 Whenever a new init segment is parsed by a sourceBuffer in the GPU Process (through the SourceBufferParser); a new TrackPrivate is created and stored in the `InitializationSegment` When the SourceBufferPrivate call the SourceBufferPrivateClient, the `RemoteSourceBufferProxy` will create a new `RemoteVideoTrackProxy` [1] This is done by `RemoteMediaPlayerProxy::addRemote[Video|Audio|Text]TrackProxy`, which will check of the track id is already existing, and if so will overwrite it with the new TrackPrivate [2] But regardless of the preview tack id, a `Remote[Video|Audio|Text]TrackProxy` will be created, with a new, unique TrackPrivateRemoteIdentifier [3] which will then create the RemoteVideoTrack/RemoteAudioTrack/RemoteTextTrack in the content process [4] The code there ensure that the existing RemoteTrack with this unique TrackPrivateRemoteIdentifier doesn't exist and will create a new one. This RemoteTrack will never be deleted, it just becomes unused as the corresponding TrackPrivate in the GPU Process got deleted. [1] https://searchfox.org/wubkat/rev/02b2f8b7a253140d82f59e38a68257431139d2e7/Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp#88,97,106 [2] https://searchfox.org/wubkat/rev/02b2f8b7a253140d82f59e38a68257431139d2e7/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp#637-643 [3] https://searchfox.org/wubkat/rev/02b2f8b7a253140d82f59e38a68257431139d2e7/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp#645-647 [4] https://searchfox.org/wubkat/rev/02b2f8b7a253140d82f59e38a68257431139d2e7/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp#762-764
Attachments
Jean-Yves Avenard [:jya]
Comment 1 2023-12-02 04:58:19 PST
[press saved to quickly] bug 242925 identify the issue, but all it did was removed the TrackPrivate from the GPU process, not the corresponding TrackPrivateRemote in the content process.
Radar WebKit Bug Importer
Comment 2 2023-12-02 04:58:39 PST
Jean-Yves Avenard [:jya]
Comment 3 2023-12-02 05:10:10 PST
EWS
Comment 4 2023-12-06 01:52:48 PST
Committed 271599@main (e0a0bc967262): <https://commits.webkit.org/271599@main> Reviewed commits have been landed. Closing PR #21207 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.