mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 04:05:49 +00:00
ab5cec5feb
We trim the initial few samples out of the opus decoder, to give the output time to converge, and to correct for the encoding delay. Encoders store the delay in the preskip field of the Ogg encapsulation header. The previous code to do this was a hack based on the granulepos values and could fail on some inputs. Instead, keep a count of how many samples we want to trip, and remove packet data until that value matches the preskip value from the header. The value is set to the preskip value from the header when the decoder is initialized. We also need to do this after seek. To do this we add a specialized nsOggReader::ResetDecode method which takes a boolean argument, set to true when we are seeking to the start of the stream. In that case, the method resets the skip count. There is still an issue after general seeks. The spec recommends trimming a full 80 ms (3840 frames) to allow the decoder to fully settle from the previous state. It's tricky to do this inside nsOpusState because it doesn't know where it is in the stream. Also add some debug output to track the decode behaviour. |
||
---|---|---|
.. | ||
Makefile.in | ||
nsOggCodecState.cpp | ||
nsOggCodecState.h | ||
nsOggDecoder.cpp | ||
nsOggDecoder.h | ||
nsOggDecoderStateMachine.cpp | ||
nsOggDecoderStateMachine.h | ||
nsOggReader.cpp | ||
nsOggReader.h |