Logging negotiation as we are seeing some errors with filtering candi… (#900)

This commit is contained in:
Raja Subramanian
2022-08-09 16:57:15 +05:30
committed by GitHub
parent 82439538e7
commit 4ec7e71b2d
3 changed files with 12 additions and 7 deletions
+7 -6
View File
@@ -554,10 +554,7 @@ func (p *ParticipantImpl) HandleOffer(sdp webrtc.SessionDescription) error {
return nil
}
p.lock.Unlock()
p.params.Logger.Debugw("answering pub offer",
"state", p.State().String(),
// "sdp", sdp.SDP,
)
p.params.Logger.Infow("received pub offer", "state", p.State().String(), "sdp", sdp.SDP)
if err := p.publisher.SetRemoteDescription(sdp); err != nil {
prometheus.ServiceOperationCounter.WithLabelValues("answer", "error", "remote_description").Add(1)
@@ -579,7 +576,9 @@ func (p *ParticipantImpl) createPublsiherAnswerAndSend() error {
return errors.Wrap(err, "could not create answer")
}
p.params.Logger.Infow("sending pub answer (unfiltered)", "state", p.State().String(), "sdp", answer.SDP)
answer = p.publisher.FilterCandidates(answer)
p.params.Logger.Infow("sending pub answer (filtered)", "state", p.State().String(), "sdp", answer.SDP)
if err = p.publisher.pc.SetLocalDescription(answer); err != nil {
prometheus.ServiceOperationCounter.WithLabelValues("answer", "error", "local_description").Add(1)
@@ -687,7 +686,7 @@ func (p *ParticipantImpl) HandleAnswer(sdp webrtc.SessionDescription) error {
if sdp.Type != webrtc.SDPTypeAnswer {
return ErrUnexpectedOffer
}
p.params.Logger.Debugw("setting subPC answer", "answer", sdp)
p.params.Logger.Infow("setting subPC answer", "answer", sdp)
if err := p.subscriber.SetRemoteDescription(sdp); err != nil {
return errors.Wrap(err, "could not set remote description")
@@ -703,10 +702,12 @@ func (p *ParticipantImpl) AddICECandidate(candidate webrtc.ICECandidateInit, tar
if target == livekit.SignalTarget_SUBSCRIBER {
if p.iceConfig.PreferSubTcp && !strings.Contains(candidate.Candidate, "tcp") {
filterOut = true
p.subscriber.Logger().Infow("filtering out candidate", "candidate", candidate.Candidate)
}
} else if target == livekit.SignalTarget_PUBLISHER {
if p.iceConfig.PreferPubTcp && !strings.Contains(candidate.Candidate, "tcp") {
filterOut = true
p.publisher.Logger().Infow("filtering out candidate", "candidate", candidate.Candidate)
}
}
p.lock.RUnlock()
@@ -1224,7 +1225,7 @@ func (p *ParticipantImpl) onOffer(offer webrtc.SessionDescription) {
return
}
p.params.Logger.Debugw("sending server offer to participant", "offer", offer)
p.params.Logger.Infow("sending server offer to participant", "offer", offer)
err := p.writeMessage(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Offer{
+2
View File
@@ -187,10 +187,12 @@ func (p *ParticipantImpl) sendIceCandidate(c *webrtc.ICECandidate, target liveki
if target == livekit.SignalTarget_SUBSCRIBER {
if p.iceConfig.PreferSubTcp && c.Protocol != webrtc.ICEProtocolTCP {
filterOut = true
p.subscriber.Logger().Infow("filtering out candidate", "candidate", c)
}
} else if target == livekit.SignalTarget_PUBLISHER {
if p.iceConfig.PreferPubTcp && c.Protocol != webrtc.ICEProtocolTCP {
filterOut = true
p.publisher.Logger().Infow("filtering out candidate", "candidate", c)
}
}
p.lock.RUnlock()
+3 -1
View File
@@ -321,7 +321,7 @@ func (t *PCTransport) AddICECandidate(candidate webrtc.ICECandidateInit) error {
return nil
}
t.params.Logger.Debugw("add candidate ", "candidate", candidate.Candidate)
t.params.Logger.Infow("add candidate ", "candidate", candidate.Candidate)
return t.pc.AddICECandidate(candidate)
}
@@ -563,7 +563,9 @@ func (t *PCTransport) createAndSendOffer(options *webrtc.OfferOptions) error {
return err
}
t.params.Logger.Infow("local offer (unfiltered)", "sdp", offer.SDP)
offer = t.filterCandidates(offer)
t.params.Logger.Infow("local offer (filtered)", "sdp", offer.SDP)
err = t.pc.SetLocalDescription(offer)
if err != nil {