From 1f2425aa9780c8611539ea675de8f95275bd9846 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Mon, 18 Sep 2023 14:15:24 -0700 Subject: [PATCH] cap incorrect timestamps to 1m --- pkg/synchronizer/track.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/synchronizer/track.go b/pkg/synchronizer/track.go index 87ca5782..c4c2a06f 100644 --- a/pkg/synchronizer/track.go +++ b/pkg/synchronizer/track.go @@ -32,6 +32,7 @@ import ( const ( ewmaWeight = 0.9 maxDrift = time.Millisecond * 15 + maxTSDelay = time.Minute maxSNDropout = 3000 // max sequence number skip uint32Half int64 = 2147483648 uint32Overflow int64 = 4294967296 @@ -186,7 +187,7 @@ func (t *TrackSynchronizer) adjust(pkt *rtp.Packet) (int64, time.Duration, bool) // sanity check pts := t.getElapsed(ts) + t.ptsOffset - if pts > time.Since(t.startedAt)+time.Hour { + if pts > time.Since(t.startedAt)+maxTSDelay { // reset RTP timestamps ts, pts = t.resetRTP(pkt) return ts, pts, false