gecko-dev/content/media/ogg
Ralph Giles ab5cec5feb Bug 758833 - Track and trim opus preskip samples - r=doublec
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.
2012-05-31 16:03:14 +12:00
..
Makefile.in Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
nsOggCodecState.cpp Bug 758833 - Track and trim opus preskip samples - r=doublec 2012-05-31 16:03:14 +12:00
nsOggCodecState.h Bug 758833 - Track and trim opus preskip samples - r=doublec 2012-05-31 16:03:14 +12:00
nsOggDecoder.cpp Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
nsOggDecoder.h Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
nsOggDecoderStateMachine.cpp Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
nsOggDecoderStateMachine.h Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
nsOggReader.cpp Bug 758833 - Track and trim opus preskip samples - r=doublec 2012-05-31 16:03:14 +12:00
nsOggReader.h Bug 758833 - Track and trim opus preskip samples - r=doublec 2012-05-31 16:03:14 +12:00