flvdemux: fix discontinuity threshold check when timestamps go backwards

Since unsigned types are used, a negative value would show as very, very
positive.
Fixes A/V sync on some... less than well made files where timestamps go
backwards.
This commit is contained in:
Vincent Penquerc'h 2011-12-03 17:30:10 +00:00
parent 1e974b1581
commit 7a7db8cbaf

View file

@ -766,11 +766,11 @@ static void
gst_flv_demux_update_resync (GstFlvDemux * demux, guint32 pts, gboolean discont,
guint32 * last, GstClockTime * offset)
{
if (!discont && ABS (pts - *last) >= RESYNC_THRESHOLD) {
gint32 dpts = pts - *last;
if (!discont && ABS (dpts) >= RESYNC_THRESHOLD) {
/* Theoretically, we should use substract the duration of the last buffer,
but this demuxer sends no durations on buffers, not sure if it cannot
know, or just does not care to calculate. */
gint32 dpts = pts - *last;
*offset -= dpts * GST_MSECOND;
GST_WARNING_OBJECT (demux,
"Large pts gap (%" G_GINT32_FORMAT " ms), assuming resync, offset now %"