Skip to content

Commit

Permalink
Fix leak in Simulcast probing
Browse files Browse the repository at this point in the history
If probing was still in flight closing the PeerConnection would not
interupt it properly.

cherry-pick of b549c95
  • Loading branch information
Sean-Der committed Sep 13, 2023
1 parent e593588 commit c785f25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions peerconnection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1660,17 +1660,17 @@ func (pc *PeerConnection) undeclaredRTPMediaProcessor() {
continue
}

pc.dtlsTransport.storeSimulcastStream(stream)

if atomic.AddUint64(&simulcastRoutineCount, 1) >= simulcastMaxProbeRoutines {
atomic.AddUint64(&simulcastRoutineCount, ^uint64(0))
pc.log.Warn(ErrSimulcastProbeOverflow.Error())
pc.dtlsTransport.storeSimulcastStream(stream)
continue
}

go func(rtpStream io.Reader, ssrc SSRC) {
if err := pc.handleIncomingSSRC(rtpStream, ssrc); err != nil {
pc.log.Errorf(incomingUnhandledRTPSsrc, ssrc, err)
pc.dtlsTransport.storeSimulcastStream(stream)
}
atomic.AddUint64(&simulcastRoutineCount, ^uint64(0))
}(stream, SSRC(ssrc))
Expand Down

0 comments on commit c785f25

Please sign in to comment.