disconnect participant when ICE connection fails

This commit is contained in:
David Zhao
2021-04-10 10:58:12 -07:00
parent 90792586bb
commit e47754179c
+3 -2
View File
@@ -722,11 +722,12 @@ func (p *ParticipantImpl) handleTrackPublished(track types.PublishedTrack) {
}
func (p *ParticipantImpl) handlePublisherICEStateChange(state webrtc.ICEConnectionState) {
//logger.Debugw("ICE connection state changed", "state", state.String())
//logger.Debugw("ICE connection state changed", "state", state.String(),
// "participant", p.identity)
if state == webrtc.ICEConnectionStateConnected {
p.connectedAt.Store(time.Now())
p.updateState(livekit.ParticipantInfo_ACTIVE)
} else if state == webrtc.ICEConnectionStateDisconnected {
} else if state == webrtc.ICEConnectionStateDisconnected || state == webrtc.ICEConnectionStateFailed {
go p.Close()
}
}