fix panic on close channel (#495)

This commit is contained in:
cnderrauber
2022-03-09 11:49:27 +08:00
committed by GitHub
parent 5b0f171bef
commit 184fc93c6a
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -1518,7 +1518,7 @@ func (p *ParticipantImpl) hasPendingMigratedTrack() bool {
} }
func (p *ParticipantImpl) onUpTrackManagerClose() { func (p *ParticipantImpl) onUpTrackManagerClose() {
close(p.rtcpCh) p.rtcpCh <- nil
} }
func (p *ParticipantImpl) getPendingTrack(clientId string, kind livekit.TrackType) (string, *livekit.TrackInfo) { func (p *ParticipantImpl) getPendingTrack(clientId string, kind livekit.TrackType) (string, *livekit.TrackInfo) {
+5 -1
View File
@@ -380,7 +380,11 @@ func (w *WebRTCReceiver) sendRTCP(packets []rtcp.Packet) {
return return
} }
w.rtcpCh <- packets select {
case w.rtcpCh <- packets:
default:
w.logger.Warnw("sendRTCP failed, rtcp channel full", nil)
}
for _, p := range packets { for _, p := range packets {
switch pkt := p.(type) { switch pkt := p.(type) {