Commit 7a7db8cb authored by Vincent Penquerc'h's avatar Vincent Penquerc'h

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.
parent 1e974b15
......@@ -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 %"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment