-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media Source Extensions for WebCodecs #576
Comments
Add link to w3ctag review request issue w3ctag/design-reviews#576
Stubs new MSE methods and overloads that, when fully implemented in later changes, would allow: 1. use of WebCodecs decoder configs as addSourceBuffer() and changeType() arguments (in lieu of parsing initialization segments from a container bytestream), and 2. buffering of WebCodecs encoded chunks via appendEncodedChunks() (in lieu of parsing media segments from a container bytestream). Much of the complexity of this initial change is in the coordination of the IDL bindings generator to achieve disambiguated overload resolution, primarily to keep the exposed API simple (only 1 actual new method name is added, corresponding to bullet 2, above), using two approaches: * Dictionary of Dictionaries: SourceBufferConfig wraps either a WebCodecs audio or video decoder configuration. Without such a distinct new type wrapping them, unioning or overloading would fail to resolve. * Unions, with caveats: the new appendEncodedChunks method takes either sequences of audio or video chunks, or single audio or video chunks, all in a single argument of IDL union type. Caveat: "sequence<A> or sequence<V>" cannot be disambiguated by the bindings, so sequence<A or V> is used in this change. Regardless, the eventual implementation would need to validate that all in the sequence are either A or all are V (along with the usual validation that appended chunks or frames also appear to use the most recent SourceBufferConfig). Caveat: The bindings generator requires help when generated union type identifiers are too long for some platforms. This change adds a seventh case to the existing hard-coded lists of names that need shortening with the generator. I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/bejy1nmoWmU/m/CQ90X3j5BQAJ TAG early-design review request: w3ctag/design-reviews#576 Explainer: https://github.com/wolenetz/mse-for-webcodecs/blob/main/explainer.md MSE spec bug: w3c/media-source#184 BUG=1144908 Change-Id: Ibc8bd806fe1790ae74fe5ce86865cdfebcdc3096 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2515199 Commit-Queue: Matthew Wolenetz <[email protected]> Reviewed-by: Dale Curtis <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Dan Sanders <[email protected]> Reviewed-by: Chrome Cunningham <[email protected]> Cr-Commit-Position: refs/heads/master@{#830837}
As it looks like WebCodecs is going through some design changes, we'd like to hold off on providing feedback until that part has been ossified. |
The EncodedAudioChunk/EncodedVideoChunk parts of the WebCodecs spec aren't in flux -- which are the only parts this depends on -- so this should be safe to look at. |
Good to know! Thanks. Will take a look. |
@ylafon and I discussed this today. We think the use-cases and the proposed API design is fine. There seems to be a bit of unanswered questions in terms of implementation details (e.g. MSE is hardware decoded, WebCodecs should also be hardware decoded, what if you don't have enough decoder capacity?) and whether or not this is a proper solution to the use-case at hand. However, we'll leave that discussion up to the group. For now, we're happy to see this move forward. Thanks for bringing this to our attention! |
@cynthia Glad to hear! Can you elaborate on your questions though? I don't think those questions are relevant to MSE. MSE makes no guarantees about whether media is hardware or software decoded or even anything about how the underlying decoder configurations are managed (intentionally so to allow user agent management of such resources). The proposed mechanism is only about allowing authors to append already demuxed data into MSE, thereby skipping the demuxing which normally happens implicitly through the byte based append methods. So it's a strict cost reduction mechanism with otherwise no impacts on how MSE functions. Did y'all have any feedback on whether these new append methods should be added as promise based? Should the interface use the non-promise style (updating, updateend events) for consistency until byte-based promise methods are available? Should we only add the promise based method for chunks once we have a promise based method for bytes? |
Raising these questions again here, as we haven't yet received a response about them:
|
Apologies for the delay.
@plinss, @atanassov and I discussed during our VF2F today. And one of the concerns we had were if promises would provide the latency guarantees that the downstream application needs (given that current MSE is event driven, it should be okay?), and if a domain specific application of promises would make it painful to upgrade when byte-based promises are available. We don't have a strong preference for either, but we'd like to hear your thoughts on this. Does the current design propose a generic path forward for a byte-based promise API? If so, we think promises are probably the right answer. |
Since the current MSE is event driven, I don't expect worsened latency due to apps instead awaiting Promise resolution/rejection via this new promise-based method for appending chunks versus what that latency would have been had it been event driven chunk-appending instead. In passing, I've heard that at least some MSE API users have already wrapped the existing event-driven byte-based append operations inside promises in their applications.
I'm not sure I understand this portion of your response. If and when Promisified versions of MSE
The path taken in MSE-for-WebCodecs' |
Thank you for the response. To be upfront, from a review point-of-view this is complete - and we are happy to see this proposal move forward. Thank you for bringing this to us and apologies for the process delay.
The question/concern here was whether or not the interoperability with generic byte-base promises (when it happens) can be a potential future pain point if this is too domain-specific, and the question was about whether or not there ideas have been exchanged around that. I think the response addresses some of the questions we had, although I'll have to check with the other reviewers to be sure. |
Stubs new MSE methods and overloads that, when fully implemented in later changes, would allow: 1. use of WebCodecs decoder configs as addSourceBuffer() and changeType() arguments (in lieu of parsing initialization segments from a container bytestream), and 2. buffering of WebCodecs encoded chunks via appendEncodedChunks() (in lieu of parsing media segments from a container bytestream). Much of the complexity of this initial change is in the coordination of the IDL bindings generator to achieve disambiguated overload resolution, primarily to keep the exposed API simple (only 1 actual new method name is added, corresponding to bullet 2, above), using two approaches: * Dictionary of Dictionaries: SourceBufferConfig wraps either a WebCodecs audio or video decoder configuration. Without such a distinct new type wrapping them, unioning or overloading would fail to resolve. * Unions, with caveats: the new appendEncodedChunks method takes either sequences of audio or video chunks, or single audio or video chunks, all in a single argument of IDL union type. Caveat: "sequence<A> or sequence<V>" cannot be disambiguated by the bindings, so sequence<A or V> is used in this change. Regardless, the eventual implementation would need to validate that all in the sequence are either A or all are V (along with the usual validation that appended chunks or frames also appear to use the most recent SourceBufferConfig). Caveat: The bindings generator requires help when generated union type identifiers are too long for some platforms. This change adds a seventh case to the existing hard-coded lists of names that need shortening with the generator. I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/bejy1nmoWmU/m/CQ90X3j5BQAJ TAG early-design review request: w3ctag/design-reviews#576 Explainer: https://github.com/wolenetz/mse-for-webcodecs/blob/main/explainer.md MSE spec bug: w3c/media-source#184 BUG=1144908 Change-Id: Ibc8bd806fe1790ae74fe5ce86865cdfebcdc3096 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2515199 Commit-Queue: Matthew Wolenetz <[email protected]> Reviewed-by: Dale Curtis <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Dan Sanders <[email protected]> Reviewed-by: Chrome Cunningham <[email protected]> Cr-Commit-Position: refs/heads/master@{#830837} GitOrigin-RevId: 6507c9cc4ae2d08d090d466da71741d8677380cf
HIQaH! QaH! TAG!
I'm requesting a TAG review of Media Source Extensions for WebCodecs.
The Media Source Extensions API (MSE) requires applications to provide fragments of containerized media (such as fragmented MP4, WebM, or MP3) to be able to buffer and play that media. If the application already has the media in a parsed and structured form, it can cost extra latency and code complexity to package that media into a container and feed it to MSE. As the web platform is evolving to give applications lower-level abstractions for efficiently encoding and decoding media via the WebCodecs API, MSE can use WebCodec's media structures to let applications more efficiently feed their media to MSE. We propose additional MSE methods to provide web authors easy ability to buffer "containerless" media as an alternative to existing MSE methods that required containerized, "muxed" media.
Further details:
You should also know that...
We'd prefer the TAG provide feedback as:
💬 leave review feedback as a comment in this issue and @-notify @wolenetz
The text was updated successfully, but these errors were encountered: