From 162e7882df542a4c4fd4b557ef1336030f1c2c67 Mon Sep 17 00:00:00 2001 From: OrlandoCo Date: Wed, 9 Dec 2020 10:13:18 -0600 Subject: [PATCH] fix(sfu): write correct ssrc for buffered packets --- pkg/buffer/interceptor.go | 3 ++- pkg/sfu/router.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/buffer/interceptor.go b/pkg/buffer/interceptor.go index 91d2b9495..f336d7617 100644 --- a/pkg/buffer/interceptor.go +++ b/pkg/buffer/interceptor.go @@ -90,7 +90,7 @@ func (i *Interceptor) BindRTCPWriter(writer interceptor.RTCPWriter) interceptor. return writer } -func (i *Interceptor) GetBufferedPackets(ssrc uint32, snOffset uint16, tsOffset uint32, sn []uint16) []rtp.Packet { +func (i *Interceptor) GetBufferedPackets(ssrc, mediaSSRC uint32, snOffset uint16, tsOffset uint32, sn []uint16) []rtp.Packet { buffer := i.getBuffer(ssrc) if buffer == nil { return nil @@ -101,6 +101,7 @@ func (i *Interceptor) GetBufferedPackets(ssrc uint32, snOffset uint16, tsOffset if err != nil { continue } + h.SSRC = mediaSSRC h.SequenceNumber -= snOffset h.Timestamp -= tsOffset pkts = append(pkts, rtp.Packet{ diff --git a/pkg/sfu/router.go b/pkg/sfu/router.go index 463987706..b51fc0909 100644 --- a/pkg/sfu/router.go +++ b/pkg/sfu/router.go @@ -204,6 +204,7 @@ func (r *router) loopDownTrackRTCP(track *DownTrack) { for _, pair := range p.Nacks { for _, pt := range r.buffer.GetBufferedPackets( track.receiver.SSRC(track.currentSpatialLayer), + track.ssrc, track.snOffset, track.tsOffset, track.nList.getNACKSeqNo(pair.PacketList())) {