Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/synchronizer/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,14 @@ func (t *TrackSynchronizer) getPTSWithoutRebase(pkt jitter.ExtPacket) (time.Dura
lastTS = ts
}

pts := t.lastPTS + t.toDuration(ts-t.lastTS)
pts := t.lastPTS + t.toDuration(ts-lastTS)
estimatedPTS := time.Since(t.startTime)
if pts < t.lastPTS || !t.acceptable(pts-estimatedPTS) {
newStartRTP := ts - t.toRTP(estimatedPTS)
t.logger.Infow(
"correcting PTS",
"currentTS", ts,
"lastTS", lastTS,
"PTS", pts,
"estimatedPTS", estimatedPTS,
"offset", pts-estimatedPTS,
Expand Down Expand Up @@ -320,13 +321,14 @@ func (t *TrackSynchronizer) getPTSWithRebase(pkt jitter.ExtPacket) (time.Duratio
lastTS = ts
}

pts := t.lastPTS + t.toDuration(ts-t.lastTS)
pts := t.lastPTS + t.toDuration(ts-lastTS)
now := mono.Now()
estimatedPTS := now.Sub(t.startTime)
if pts < t.lastPTS || !t.acceptable(pts-estimatedPTS) {
t.logger.Infow(
"correcting PTS",
"currentTS", ts,
"lastTS", lastTS,
"PTS", pts,
"estimatedPTS", estimatedPTS,
"offset", pts-estimatedPTS,
Expand Down
Loading