Enable Media Source Extensions (MSE) API usage from DedicatedWorker contexts to enable improved performance of buffering media for playback by an HTMLMediaElement on the main Window context. By creating a MediaSource object on a DedicatedWorker context, an application may then obtain a MediaSourceHandle from it and transfer that handle to the main thread for use in attaching to an HTMLMediaElement. The context that created the MediaSource object may then use it to buffer media.
Main interoperability risk is that other browsers may not implement it. Compatibility risk is mitigated by unchanged same-thread MSE API support and proactive feature-detectability of MSE-in-Workers with a new canConstructInDedicatedWorker attribute on the MediaSource interface.
DedicatedWorker, WorkerGlobalScope and postMessage/onmessage availability is integral to using this feature.
The primary risk is the potential difficulty in refactoring existing MSE web applications to (conditionally, depending on browser support) perform buffering in a different execution context from the Window context that hosts the DOM and the media element. The benefit of potentially improved buffering performance by offloading the MSE API usage to a worker context provides motivation to overcome this challenge.
Unpredictability of racing context destruction of either the main thread hosting the media element (and owning the underlying MSE media demuxer and player) or the dedicated worker thread hosting the interface to the MSE demuxer when using MSE from a worker context motivated careful design of a refcounted, outside-of-Oilpan, attachment abstraction to ensure safety of operations using locks and having a lifetime that exceeds those execution contexts. Preventing use-after-free and similar was a primary complexity of implementation and a focus area of added tests.
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
Not potentially high risk.
Feature consists of exposing existing interfaces also on a DedicatedWorker, and addition of a WebIDL method for proactively detecting support for this feature, and are covered by basic tooling.
MSE and DedicatedWorker already exist on all six Blink platforms. This feature lets MSE work from DedicatedWorker contexts.
Does the feature depend on any code or APIs outside the Chromium open source repository and its open-source dependencies to function?
No.OriginTrial desktop last | 103 |
OriginTrial desktop first | 95 |
OriginTrial Android last | 103 |
OriginTrial Android first | 95 |
None currently for this feature.
LGTM1--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/000000000000eea04c05e4e53819%40google.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAL5BFfWsqYRjB%3DqCuu4UxHzEa%2B%2B2SqkDJdE8W8sUNCnS%2BwoH5w%40mail.gmail.com.
NOTE: Requested desktop and Android ship milestone: 105 (The 'edit estimated milestones' link from chromestatus didn't result in such ability to edit, so I'm adding this request explicitly here.)
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/91d78e87-3241-0719-eb2a-a7e8d21afd0b%40chromium.org.
"If the implementation does not support creating a handle for this MediaSource, then throw a NotSupportedError exception and abort these steps.NOTE Implementations MAY choose to only allow handle creation for MediaSource objects in a DedicatedWorkerGlobalScope, as a minimum requirement for enabling attachment of such a MediaSource object to an HTMLMediaElement."
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAJUhtG8EH2E1y33qLPJr3xdp8ZT1z1T98mCQ9bJ4WeBn19BOsQ%40mail.gmail.com.
Regarding the scope of the fix involved in this relaunch, it removes visibility of the new handle attribute from the main/Window context (and updates test expectations, accordingly.)While that change alone would fix the regression, it risks potential for unexpected exception in future if that attribute were ever exposed again on the main/Window context.Therefore, both the spec and implementation involved in this relaunch also remove the ability to throw NotSupportedError exception by this attribute's getter.With the net change versus the previous launch being specific to fixing this regression, and with the relaunch CL also including base::Feature guards for the two blink RuntimeEnabled features for MSE-in-Workers, I believe the risk of relaunch causing respin to be small even if some similar scope of regression were found after the feature reached stable.MattOn Wed, Sep 28, 2022 at 12:40 PM Matthew Wolenetz <wole...@chromium.org> wrote:Per previous LGTMs on this, the feature launched in M105: https://chromium-review.googlesource.com/c/chromium/src/+/3795560Unfortunately, both the MSE spec and Chromium implementation for this feature included logic which regressed some media playback sites, and the regression was found late after the feature reached stable in M105.The launch was reverted from 105 (and 106-108 also have had this feature reverted explicitly back to experimental).The regression was due to the MediaSource object's new handle attribute being:
- Visible on both main/Window and on Dedicated Worker contexts (not just the latter), and
- Throwing NotSupportedError exception if read from on a context (main/Window, in this case) where the implementation does not support using a MediaSourceHandle for attaching the MediaSource object owned by that context.
The specific MSE spec language involved in this regression (from https://github.com/w3c/media-source/pull/306):"If the implementation does not support creating a handle for this MediaSource, then throw a NotSupportedError exception and abort these steps.NOTE Implementations MAY choose to only allow handle creation for MediaSource objects in a DedicatedWorkerGlobalScope, as a minimum requirement for enabling attachment of such a MediaSource object to an HTMLMediaElement."Uncaught by myself nor multiple reviewers (except partially by cas...@chromium.org, who asked about precedent for throwing exceptions in attribute getters), there was a pre-existing behavior pattern in at least one older version of a media playback javascript library (video.js) that enumerated all MediaSource object attributes, including reading from them and obtaining an unexpected exception on reading this new handle attribute on the main/Window context.
Also uncaught by myself nor reviewers was the lack of "flag-guarding" of this feature (it only had blink runtime enabled features, not corresponding base::Features), so the revert in M105 stable of the previous launch required a binary respin.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ea179069-c57f-0b83-0377-dfe394e892fc%40chromium.org.
Huh! Might be worthwhile to file an issue on the TAG's design principles to warn against making getters throw exceptions or have any other side effects for that matter.
Maybe our process should strongly-recommend/require adding a base_feature flag for anything that changes the API shape, as it's very hard to predict such breakage..
Huh! Might be worthwhile to file an issue on the TAG's design principles to warn against making getters throw exceptions or have any other side effects for that matter.Indeed, I am tracking this as a potential follow-up and will update here with a TAG issue once filed.
Maybe our process should strongly-recommend/require adding a base_feature flag for anything that changes the API shape, as it's very hard to predict such breakage..I'll re-read the recent PSA about flag-guarding, and if it's unclear, will request this be added.
I'm also considering adding a PRESUBMIT warning ...