Skip to content

merge_pr_29068

Worker JS accessing MediaSource.duration wasn't taking the necessary
CrossThreadAttachment lock. It should, so that it can safely access the
underlying main-thread-owned demuxer to retrieve its duration.

This change refactors MediaSource::duration() so that only the IDL calls
it, and both it and all other previous callers of duration() are updated
to instead call GetDuration_Locked. duration() calls GetDuration_Locked
via the existing MediaSource::RunUnlessElementGoneOrClosingUs()
machinery that ensures the call only occurs while it is safe to access
the underlying demuxer. Other callers of MediaSource::duration() were
already running in the context of that machinery, and are updated to
provide the appropriate ExclusiveKey to confirm that contract statically
during build (like all the other paths already using that machinery).

Bug: 1211551,878133

Change-Id: I44b97e63e2a2bd9473f4cd0fc07bc734b344bf2d
Fixed: 1211551
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2909389
Commit-Queue: Matthew Wolenetz <[email protected]>
Reviewed-by: Will Cassella <[email protected]>
Cr-Commit-Position: refs/heads/master@{#886576}
Assets 2
Loading