Skip to content

Commit

Permalink
fix(sfu): revert rebaseTS (#553)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
OrlandoCo authored Jul 15, 2021
1 parent cf4a550 commit 62bac79
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pkg/sfu/downtrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type DownTrack struct {

enabled atomicBool
reSync atomicBool
reBaseTs atomicBool
snOffset uint16
tsOffset uint32
lastSSRC uint32
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
}

d.snOffset = extPkt.Packet.SequenceNumber - d.lastSN - 1
d.tsOffset = extPkt.Packet.Timestamp - d.lastTS - 1

atomic.StoreUint32(&d.lastSSRC, extPkt.Packet.SSRC)
d.reSync.set(false)
}
Expand Down

0 comments on commit 62bac79

Please sign in to comment.