From 249b83882031a80a310e16d162564cad65e1cd53 Mon Sep 17 00:00:00 2001 From: Matt Wolenetz Date: Sat, 13 Nov 2021 10:10:14 +0000 Subject: [PATCH] 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 Commit-Queue: Will Cassella Auto-Submit: Matthew Wolenetz Reviewed-by: Will Cassella Cr-Commit-Position: refs/heads/main@{#940603} -- wpt-commits: cc6a981ed8a6988e31e657fd43f8a19dc6068a44 wpt-pr: 31590 --- .../media-source/dedicated-worker/mediasource-worker-play.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-play.js b/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-play.js index f11c1fd8d0d7..0312f16fd99e 100644 --- a/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-play.js +++ b/testing/web-platform/tests/media-source/dedicated-worker/mediasource-worker-play.js @@ -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);