RESOLVED FIXED 237780
[MSE][SourceBuffer] Fix removal of paddings from buffered range
https://bugs.webkit.org/show_bug.cgi?id=237780
Summary [MSE][SourceBuffer] Fix removal of paddings from buffered range
Enrique Ocaña
Reported 2022-03-11 06:38:41 PST
This change fixes high memory usage in apps that do TS -> MP4 transmuxing. The high memory usage is observed in some streams that have a slight overlap in media samples (usually happens on video quality change), when application applies its own logic for samples removal (that looks like sourceBuffer.remove(sourceBuffer.buffered.start(0), ...)). Current implementation reports a buffered range that is inconsistent with the actual samples that are still in the buffer (after range removal). The reported range excludes one sample, allowing that sample to "leak". Such a sample holds a reference to the entire appended chunk (due to in-place demuxing in GStreamer MSE backend), but it accounts only for a small size in the buffer. So eviction algorithm doesn't kick in. See the full discussion of this problem here: https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/797#discussion_r818973424
Attachments
Patch (8.38 KB, patch)
2022-03-11 09:56 PST, Enrique Ocaña
no flags
Enrique Ocaña
Comment 1 2022-03-11 09:56:29 PST
Jer Noble
Comment 2 2022-03-11 10:05:15 PST
Comment on attachment 454492 [details] Patch Thanks for the patch, and thanks for working with me on it in the WPEWebKit repo. r=me once the EWS clears it.
Enrique Ocaña
Comment 3 2022-03-11 10:11:42 PST
All the merit goes to Eugene, not to me. He took the time to debug and solve the issue, as well as creating the test case. I just ported it.
Enrique Ocaña
Comment 4 2022-03-14 05:52:56 PDT
The editing/spelling/spellcheck-api-crash.html failed test in the ios-wk2 EWS is completely unrelated to MSE and to the changes done in this patch. Also "MediaSource is not currently supported on iOS". I'm assuming that I can ignore it and safely land the patch.
EWS
Comment 5 2022-03-14 06:22:54 PDT
Committed r291225 (248380@main): <https://commits.webkit.org/248380@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 454492 [details].
Radar WebKit Bug Importer
Comment 6 2022-03-14 06:23:17 PDT
Note You need to log in before you can comment on or make changes to this bug.