Log sdps when negotiate failed (#3325)
This commit is contained in:
+24
-13
@@ -1419,7 +1419,7 @@ func (t *PCTransport) initPCWithPreviousAnswer(previousAnswer webrtc.SessionDesc
|
|||||||
func (t *PCTransport) SetPreviousSdp(offer, answer *webrtc.SessionDescription) {
|
func (t *PCTransport) SetPreviousSdp(offer, answer *webrtc.SessionDescription) {
|
||||||
// when there is no previous answer, cannot migrate, force a full reconnect
|
// when there is no previous answer, cannot migrate, force a full reconnect
|
||||||
if answer == nil {
|
if answer == nil {
|
||||||
t.params.Handler.OnNegotiationFailed()
|
t.onNegotiationFailed(true, "no previous answer for previous sdp")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1427,10 +1427,9 @@ func (t *PCTransport) SetPreviousSdp(offer, answer *webrtc.SessionDescription) {
|
|||||||
if t.pc.RemoteDescription() == nil && t.previousAnswer == nil {
|
if t.pc.RemoteDescription() == nil && t.previousAnswer == nil {
|
||||||
t.previousAnswer = answer
|
t.previousAnswer = answer
|
||||||
if senders, err := t.initPCWithPreviousAnswer(*t.previousAnswer); err != nil {
|
if senders, err := t.initPCWithPreviousAnswer(*t.previousAnswer); err != nil {
|
||||||
t.params.Logger.Warnw("initPCWithPreviousAnswer failed", err)
|
|
||||||
t.lock.Unlock()
|
t.lock.Unlock()
|
||||||
|
|
||||||
t.params.Handler.OnNegotiationFailed()
|
t.onNegotiationFailed(true, fmt.Sprintf("initPCWithPreviousAnswer failed, error: %s", err))
|
||||||
return
|
return
|
||||||
} else if offer != nil {
|
} else if offer != nil {
|
||||||
// in migration case, can't reuse transceiver before negotiated except track subscribed at previous node
|
// in migration case, can't reuse transceiver before negotiated except track subscribed at previous node
|
||||||
@@ -1495,8 +1494,7 @@ func (t *PCTransport) postEvent(e event) {
|
|||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !e.isClosed.Load() {
|
if !e.isClosed.Load() {
|
||||||
e.params.Logger.Warnw("error handling event", err, "event", e.String())
|
e.onNegotiationFailed(true, fmt.Sprintf("error handling event. err: %s, event: %s", err, e))
|
||||||
e.params.Handler.OnNegotiationFailed()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, e)
|
}, e)
|
||||||
@@ -1702,14 +1700,7 @@ func (t *PCTransport) setupSignalStateCheckTimer() {
|
|||||||
failed := t.negotiationState != transport.NegotiationStateNone
|
failed := t.negotiationState != transport.NegotiationStateNone
|
||||||
|
|
||||||
if t.negotiateCounter.Load() == negotiateVersion && failed && t.pc.ConnectionState() == webrtc.PeerConnectionStateConnected {
|
if t.negotiateCounter.Load() == negotiateVersion && failed && t.pc.ConnectionState() == webrtc.PeerConnectionStateConnected {
|
||||||
t.params.Logger.Infow(
|
t.onNegotiationFailed(false, "negotiation timed out")
|
||||||
"negotiation timed out",
|
|
||||||
"localCurrent", t.pc.CurrentLocalDescription(),
|
|
||||||
"localPending", t.pc.PendingLocalDescription(),
|
|
||||||
"remoteCurrent", t.pc.CurrentRemoteDescription(),
|
|
||||||
"remotePending", t.pc.PendingRemoteDescription(),
|
|
||||||
)
|
|
||||||
t.params.Handler.OnNegotiationFailed()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -2066,6 +2057,26 @@ func (t *PCTransport) handleICERestart(_ event) error {
|
|||||||
return t.doICERestart()
|
return t.doICERestart()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *PCTransport) onNegotiationFailed(warning bool, reason string) {
|
||||||
|
logFields := []interface{}{
|
||||||
|
"reason", reason,
|
||||||
|
"localCurrent", t.pc.CurrentLocalDescription(),
|
||||||
|
"localPending", t.pc.PendingLocalDescription(),
|
||||||
|
"remoteCurrent", t.pc.CurrentRemoteDescription(),
|
||||||
|
"remotePending", t.pc.PendingRemoteDescription(),
|
||||||
|
}
|
||||||
|
if warning {
|
||||||
|
t.params.Logger.Warnw(
|
||||||
|
"negotiation failed",
|
||||||
|
nil,
|
||||||
|
logFields...,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
t.params.Logger.Infow("negotiation failed", logFields...)
|
||||||
|
}
|
||||||
|
t.params.Handler.OnNegotiationFailed()
|
||||||
|
}
|
||||||
|
|
||||||
// configure subscriber transceiver for audio stereo and nack
|
// configure subscriber transceiver for audio stereo and nack
|
||||||
// pion doesn't support per transciver codec configuration, so the nack of this session will be disabled
|
// pion doesn't support per transciver codec configuration, so the nack of this session will be disabled
|
||||||
// forever once it is first disabled by a transceiver.
|
// forever once it is first disabled by a transceiver.
|
||||||
|
|||||||
Reference in New Issue
Block a user