fix potential nil rtcp packets cause rtcpSendWorker exit (#504)

This commit is contained in:
cnderrauber
2022-03-11 15:40:24 +08:00
committed by GitHub
parent b6975bf7cd
commit a5fa54853f
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -562,9 +562,11 @@ func (b *Buffer) doReports(arrivalTime int64) {
// RTCP reports // RTCP reports
pkts := b.getRTCP() pkts := b.getRTCP()
b.callbacksQueue.Enqueue(func() { if pkts != nil {
b.feedbackCB(pkts) b.callbacksQueue.Enqueue(func() {
}) b.feedbackCB(pkts)
})
}
} }
func (b *Buffer) buildNACKPacket() ([]rtcp.Packet, int) { func (b *Buffer) buildNACKPacket() ([]rtcp.Packet, int) {
+1 -1
View File
@@ -377,7 +377,7 @@ func (w *WebRTCReceiver) DeleteDownTrack(peerID livekit.ParticipantID) {
} }
func (w *WebRTCReceiver) sendRTCP(packets []rtcp.Packet) { func (w *WebRTCReceiver) sendRTCP(packets []rtcp.Packet) {
if w.closed.Load() { if packets == nil || w.closed.Load() {
return return
} }