mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 15:35:41 +00:00
defensive check for peer connection instance (#4350)
This commit is contained in:
@@ -542,9 +542,17 @@ func (t *TransportManager) HandleAnswer(answer webrtc.SessionDescription, answer
|
||||
func (t *TransportManager) AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) {
|
||||
switch target {
|
||||
case livekit.SignalTarget_PUBLISHER:
|
||||
t.publisher.AddICECandidate(candidate)
|
||||
if t.publisher != nil {
|
||||
t.publisher.AddICECandidate(candidate)
|
||||
} else {
|
||||
t.params.Logger.Warnw("ice candidate for publisher, but no peer connection", nil, "candidate", candidate)
|
||||
}
|
||||
case livekit.SignalTarget_SUBSCRIBER:
|
||||
t.subscriber.AddICECandidate(candidate)
|
||||
if t.subscriber != nil {
|
||||
t.subscriber.AddICECandidate(candidate)
|
||||
} else {
|
||||
t.params.Logger.Warnw("ice candidate for subscriber, but no peer connection", nil, "candidate", candidate)
|
||||
}
|
||||
default:
|
||||
err := errors.New("unknown signal target")
|
||||
t.params.Logger.Errorw("ice candidate for unknown signal target", err, "target", target)
|
||||
|
||||
Reference in New Issue
Block a user