w3c / media-source

Media Source Extensions
https://w3c.github.io/media-source/
Other
267 stars 59 forks source link

MSE-for-WebCodecs: detection of mismatch of append format (WC vs BSF) is deferred and could produce decode err #301

Open wolenetz opened 2 years ago

wolenetz commented 2 years ago

MSE-for-WebCodecs feature issue is #184.

The prototype implementation of this feature in Chromium informed the initial draft spec. One of these considerations may need adjusting:

If a SourceBuffer was configured to expect appendBuffer (by addSourceBuffer or changeType), but appendEncodedChunks occurs instead (or vice-versa), the synchronous portions of the respective appendBuffer or appendEncodedChunks call do not detect this. Instead, the respective asynchronous "Buffer Append" or "Chunks Append" algorithms detect this and produce an append error, which produces a decode error.

Since this situation is rapidly detectable in the synchronous portion, and the consequence of delayed detection could cause the need to tear down the MSE attachment and restart it due to decode error, this issue tracks possibly updating the specification to do this rapid detection and non-fatal exception throwing or promise rejection, respectively, instead.

I've filed this to track likely upcoming work while this feature spec and implementation is stabilizing. Comments are most certainly welcome.