Bug 1740633 [wpt PR 31590] - MSE-in-Workers: Fix deadlock on duration reduction, a=testonly

Automatic update from web-platform-tests
MSE-in-Workers: Fix deadlock on duration reduction

If MediaSourceInWorkers is enabled but MediaSourceNewAbortAndDuration is
not enabled, then when MediaSource duration is reduced, a deprecated
code path calls each SourceBuffer in the MediaSource to remove the media
that might potentially be truncated by the duration reduction. This
remove call itself took the same lock that is already held in the caller
in this case, causing unresponsive page due to double-lock on the
CrossThreadMediaSourceAttachment's lock.

This change calls Remove_Locked instead, since the preconditions checked
in SourceBuffer::remove are already enforced in
MediaSource::setDuration, and the double-lock is avoided.

This change also fixes a stray call to setting duration in a
MSE-in-Worker test to use the correct interface (though such call would
not have hit this double-lock on bots since those bots enable all
experimental web platform features.)

BUG=1268614,878133
TEST=manually confirmed repro fixed locally

Change-Id: I1a144cdab9bae5f66b6e1137c2b275c392c12023
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3274133
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Commit-Queue: Will Cassella <cassew@chromium.org>
Auto-Submit: Matthew Wolenetz <wolenetz@chromium.org>
Reviewed-by: Will Cassella <cassew@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940603}

--

wpt-commits: cc6a981ed8a6988e31e657fd43f8a19dc6068a44
wpt-pr: 31590
This commit is contained in:
Matt Wolenetz 2021-11-13 10:10:14 +00:00 committed by moz-wptsync-bot
parent e5b8b6525b
commit 249b838820

View File

@ -23,7 +23,7 @@ util.mediaSource.addEventListener("sourceopen", () => {
// Shorten the buffered media and test playback duration to avoid timeouts.
sourceBuffer.remove(0.5, Infinity);
sourceBuffer.onupdateend = () => {
sourceBuffer.duration = 0.5;
util.mediaSource.duration = 0.5;
// Issue changeType to the same type that we've already buffered.
// Unnecessary for this buffering, except helps with test coverage.
sourceBuffer.changeType(util.mediaMetadata.type);