Skip to content

Commit 25ae5bc

Browse files
authored
Fixing offset calculation (#723)
Sender reports shouldn't overwrite the desired offset but update it. Also signal the correct diff in onSR callbacks,
1 parent d57b069 commit 25ae5bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/synchronizer/track.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,14 @@ func (t *TrackSynchronizer) onSenderReport(pkt *rtcp.SenderReport) {
164164

165165
offset := mediatransportutil.NtpTime(pkt.NTPTime).Time().Sub(t.startTime.Add(pts))
166166
if t.onSR != nil {
167-
t.onSR(offset - t.desiredPTSOffset)
167+
t.onSR(offset)
168168
}
169169

170170
if !t.acceptable(offset) {
171171
return
172172
}
173173

174-
t.desiredPTSOffset = offset
174+
t.desiredPTSOffset += offset
175175
t.lastSR = pkt.RTPTime
176176
}
177177

0 commit comments

Comments
 (0)