Skip to content

Commit

Permalink
fix(sfu): Fix ice logs (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrlandoCo authored Jan 5, 2021
1 parent 457db65 commit f7c0f63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/sfu/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func (p *Peer) Join(sid string, sdp webrtc.SessionDescription) (*webrtc.SessionD
})

p.subscriber.OnICECandidate(func(c *webrtc.ICECandidate) {
log.Debugf("on ice candidate called")
log.Debugf("on subscriber ice candidate called for peer " + p.id)
if c == nil {
return
}
Expand All @@ -116,7 +116,7 @@ func (p *Peer) Join(sid string, sdp webrtc.SessionDescription) (*webrtc.SessionD
})

p.publisher.OnICECandidate(func(c *webrtc.ICECandidate) {
log.Debugf("on ice candidate called")
log.Debugf("on publisher ice candidate called for peer " + p.id)
if c == nil {
return
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/sfu/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ func (p *Publisher) Answer(offer webrtc.SessionDescription) (webrtc.SessionDescr
}

for _, c := range p.candidates {
p.pc.AddICECandidate(c)
if err := p.pc.AddICECandidate(c); err != nil {
log.Errorf("Add publisher ice candidate to peer %s err: %v", p.id, err)
}
}
p.candidates = nil

Expand Down
4 changes: 3 additions & 1 deletion pkg/sfu/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ func (s *Subscriber) SetRemoteDescription(desc webrtc.SessionDescription) error
}

for _, c := range s.candidates {
s.pc.AddICECandidate(c)
if err := s.pc.AddICECandidate(c); err != nil {
log.Errorf("Add subscriber ice candidate to peer %s err: %v", s.id, err)
}
}
s.candidates = nil

Expand Down

0 comments on commit f7c0f63

Please sign in to comment.