The Opus decoder requires some time to converge after a seek. The spec recommends players start decoding 80 ms (3840 samples at 48 kHz) before the intended seek target and discard that initial output.
This is generally referred to as 'preroll'. It makes the most sense to handle this in nsOggReader (or nsBuiltinDecoder) where seeking is implemented. In particular, the preroll target must be clipped against the start of the stream, the time origen, or even buffered ranges, and the Reader is what's keeping track of where the decoder is in the stream.
This bug is about extending the seek logic in nsOggReader to start the decoder 80 ms ahead of the seek target. The existing logic in nsBuiltinDecoderReader::DecodeToTarget will then discard the extra samples up to the real seek point.
Created attachment 628098 [details] [diff] [review]
Handle preroll correctly during an Opus seek
Greenish on try: https://tbpl.mozilla.org/?tree=Try&rev=351135ba6c51