GNOME Bugzilla – Bug 547075
[speex] Encoder doesn't handle non-zero start timestamps and discontinuities properly
Last modified: 2008-08-31 15:01:17 UTC
Hi, the speex encoder (and also the celt encoder which is more or less the same code) doesn't handle non-zero start timestamps and discontinuities properly. It simply starts to count at 0 and ignores all upstream timestamps. This can lead to a/v synchronization issues when muxing together with video. The fix for this is probably to a) get the start timestamp and offset all timestamps and granulepos with that and b) if a discontinuity is detected encode everything in the GstAdapter (if necessary add some silence) and then continue to encode the discont buffer and all following with the new timestamps.
2008-08-31 Sebastian Dröge <sebastian.droege@collabora.co.uk> * ext/speex/gstspeexdec.c: (speex_dec_chain_parse_data): Correctly take the granulepos from upstream if possible and correctly handle the granulepos in various calculations: the granulepos is the sample number of the _last_ sample in a frame, not the first. * ext/speex/gstspeexenc.c: (gst_speex_enc_sinkevent), (gst_speex_enc_encode), (gst_speex_enc_chain), (gst_speex_enc_change_state): * ext/speex/gstspeexenc.h: Handle non-zero start timestamps in the encoder and detect/handle stream discontinuities. Fixes bug #547075.
2008-08-31 Sebastian Dröge <sebastian.droege@collabora.co.uk> * ext/celt/gstceltdec.c: (celt_dec_chain_parse_data): Correctly take the granulepos from upstream if possible and correctly handle the granulepos in various calculations: the granulepos is the sample number of the _last_ sample in a frame, not the first. * ext/celt/gstceltenc.c: (gst_celt_enc_sinkevent), (gst_celt_enc_encode), (gst_celt_enc_chain), (gst_celt_enc_change_state): * ext/celt/gstceltenc.h: Handle non-zero start timestamps in the encoder and detect/handle stream discontinuities. Fixes bug #547075.