Avoid reconnect loop for unsupported downtrack (#1754)
* Avoid reconnect loop for unsupported downtrack If the client subscribes to a track which codec is unsupported by the client, sfu will trigger negotiation failed and issue a full reconnect after received client answer. If the client try to subscribe that track then it will got full reconnect again. That will cause a infinite reconnect loop until the client don't subscribe that track. This PR will unsubscribe the error track for the client and send a SubscriptionResponse that contain the reason to indicates the track's codec is not supported to avoid the reconnect loop.
This commit is contained in:
@@ -1865,7 +1865,13 @@ func (t *PCTransport) handleRemoteOfferReceived(sd *webrtc.SessionDescription) e
|
||||
|
||||
func (t *PCTransport) handleRemoteAnswerReceived(sd *webrtc.SessionDescription) error {
|
||||
if err := t.setRemoteDescription(*sd); err != nil {
|
||||
return err
|
||||
// Pion will call RTPSender.Send method for each new added Downtrack, and return error if the DownTrack.Bind
|
||||
// returns error. In case of Downtrack.Bind returns ErrUnsupportedCodec, the signal state will be stable as negotiation is aleady compelted
|
||||
// before startRTPSenders, and the peerconnection state can be recovered by next negotiation which will be triggered
|
||||
// by the SubscriptionManager unsubscribe the failure DownTrack. So don't treat this error as negotiation failure.
|
||||
if !errors.Is(err, webrtc.ErrUnsupportedCodec) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
t.clearSignalStateCheckTimer()
|
||||
|
||||
Reference in New Issue
Block a user