fix(sfu): revert rebaseTS
RebaseTS will only allow to set offsets on first sync, causing issues on muting using API since TS and SN would be left in wrong state
@@ -45,7 +45,6 @@ type DownTrack struct {
enabled atomicBool
reSync atomicBool
- reBaseTs atomicBool
snOffset uint16
tsOffset uint32
lastSSRC uint32
@@ -95,7 +94,6 @@ func (d *DownTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters,
d.writeStream = t.WriteStream()
d.mime = strings.ToLower(codec.MimeType)
d.reSync.set(true)
- d.reBaseTs.set(true)
d.enabled.set(true)
if rr := d.bufferFactory.GetOrNew(packetio.RTCPBufferPacket, uint32(t.SSRC())).(*buffer.RTCPReader); rr != nil {
rr.OnPacket(func(pkt []byte) {
@@ -346,11 +344,10 @@ func (d *DownTrack) writeSimpleRTP(extPkt *buffer.ExtPacket) error {
return nil
}
}
- if d.reBaseTs.get() {
+
d.snOffset = extPkt.Packet.SequenceNumber - d.lastSN - 1
d.tsOffset = extPkt.Packet.Timestamp - d.lastTS - 1
- d.reBaseTs.set(false)
- }
+
atomic.StoreUint32(&d.lastSSRC, extPkt.Packet.SSRC)
d.reSync.set(false)
}
