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:
@@ -128,7 +128,11 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
|
||||
// Bind callback can happen from replaceTrack, so set it up early
|
||||
var reusingTransceiver atomic.Bool
|
||||
var dtState sfu.DownTrackState
|
||||
downTrack.OnBinding(func() {
|
||||
downTrack.OnBinding(func(err error) {
|
||||
if err != nil {
|
||||
go subTrack.Bound(err)
|
||||
return
|
||||
}
|
||||
wr.DetermineReceiver(downTrack.Codec())
|
||||
if reusingTransceiver.Load() {
|
||||
downTrack.SeedState(dtState)
|
||||
@@ -142,7 +146,7 @@ func (t *MediaTrackSubscriptions) AddSubscriber(sub types.LocalParticipant, wr *
|
||||
)
|
||||
}
|
||||
|
||||
go subTrack.Bound()
|
||||
go subTrack.Bound(nil)
|
||||
|
||||
subTrack.SetPublisherMuted(t.params.MediaTrack.IsMuted())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user