Skip to content

Commit

Permalink
Fix prevent nil pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
OrlandoCo committed Feb 1, 2021
1 parent a644c83 commit b5b8139
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/sfu/downtrack.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ func (d *DownTrack) handleRTCP(bytes []byte) {
}
}
if d.trackType == SimulcastDownTrack && maxRatePacketLoss != 0 || expectedMinBitrate != 0 {
d.handleLayerChange(maxRatePacketLoss, expectedMinBitrate)
}

if len(fwdPkts) > 0 {
Expand Down
6 changes: 5 additions & 1 deletion pkg/sfu/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ func (w *WebRTCReceiver) RetransmitPackets(track *DownTrack, packets []packetMet
w.nackWorker.Submit(func() {
for _, meta := range packets {
pktBuff := packetFactory.Get().([]byte)
i, err := w.buffers[meta.getLayer()].GetPacket(pktBuff, meta.getSourceSeqNo())
buff := w.buffers[meta.getLayer()]
if buff == nil {
break
}
i, err := buff.GetPacket(pktBuff, meta.getSourceSeqNo())
if err != nil {
if err == io.EOF {
break
Expand Down

0 comments on commit b5b8139

Please sign in to comment.