w3c / media-source

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

Normatively allow user agents that don't do audio splice crossfading to do other things than just insert silence #165

Open wolenetz opened 7 years ago

wolenetz commented 7 years ago

The V1 MSE spec's audio splice frame algorithm allows for only 2 cases, where others may be preferred by user agents. Existing cases: 1) (normatively spec'ed) User agent does not support cross-fading. Insert silence for the portion of the overlapped frame that remains after being overlapped. (non-normatively:) Optionally fade to/from that silence when rendering that inserted silence. 2) (normatively spec'ed) User agent does support cross-fading. Retain the existing overlapped frame and do a 5 millisecon d cross-fade from it to the overlapping frame content at the splice point where the overlapping frame begins.

This bug tracks adding an alternative approach normatively: 3) User agent does not support cross-fading. Neither does user agent want to insert silence. Rather, just trim the overlapped frame right at the splice point (the adjusted-to-overlapped-frame-samplerate overlapping frame's PTS). Something like the following text:

Note: Chrome is taking this new approach in https://codereview.chromium.org/2343543002. Due to unfortunate amount of badly muxed media timestamp and duration information in media used with MSE in the wild, Chrome encounters a significant number of audio splice rendering algorithm failures because the actual accumulation of decoded samples sometimes doesn't match the coded frame's timestamps and durations. This alternative approach allows simplification with the loss of just the 5 millisecond cross-fade. While the existing "insert-silence" alternative would also simplify the handling of such badly muxed media, it comes with reduced UX (complete loss of overlapped frame decoded audio samples).

Note to editors: This seems like something that could be done after V1 is in PR or even REC. It is more a quality-of-implementation item, and doesn't change the existing alternatives for how to handle splices; rather it adds a further alternative.

Triaging as VNext accordingly.