revert network cost change (#550)
This commit is contained in:
@@ -36,7 +36,6 @@ const (
|
|||||||
rttUpdateInterval = 5 * time.Second
|
rttUpdateInterval = 5 * time.Second
|
||||||
|
|
||||||
stateActiveCond = 3 // reliableDCOpen,lossyDCOpen,PeerConnectionStateConnected
|
stateActiveCond = 3 // reliableDCOpen,lossyDCOpen,PeerConnectionStateConnected
|
||||||
initNetWorkCost = 100
|
|
||||||
disconnectCleanupDuration = 15 * time.Second
|
disconnectCleanupDuration = 15 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -129,7 +128,6 @@ type ParticipantImpl struct {
|
|||||||
onClaimsChanged func(participant types.LocalParticipant)
|
onClaimsChanged func(participant types.LocalParticipant)
|
||||||
|
|
||||||
activeCounter atomic.Int32
|
activeCounter atomic.Int32
|
||||||
networkCost int32
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
||||||
@@ -151,7 +149,6 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
|||||||
disallowedSubscriptions: make(map[livekit.TrackID]livekit.ParticipantID),
|
disallowedSubscriptions: make(map[livekit.TrackID]livekit.ParticipantID),
|
||||||
connectedAt: time.Now(),
|
connectedAt: time.Now(),
|
||||||
rttUpdatedAt: time.Now(),
|
rttUpdatedAt: time.Now(),
|
||||||
networkCost: initNetWorkCost,
|
|
||||||
}
|
}
|
||||||
p.version.Store(params.InitialVersion)
|
p.version.Store(params.InitialVersion)
|
||||||
p.migrateState.Store(types.MigrateStateInit)
|
p.migrateState.Store(types.MigrateStateInit)
|
||||||
@@ -606,9 +603,6 @@ func (p *ParticipantImpl) SetMigrateState(s types.MigrateState) {
|
|||||||
p.pendingOffer = nil
|
p.pendingOffer = nil
|
||||||
// in case of migration, subscriber data channel will not fire OnOpen callback
|
// in case of migration, subscriber data channel will not fire OnOpen callback
|
||||||
p.activeCounter.CAS(0, 2)
|
p.activeCounter.CAS(0, 2)
|
||||||
|
|
||||||
// use lower network cost to make sure migrated's node has higher priority candidate
|
|
||||||
p.networkCost--
|
|
||||||
}
|
}
|
||||||
p.lock.Unlock()
|
p.lock.Unlock()
|
||||||
if s == types.MigrateStateComplete {
|
if s == types.MigrateStateComplete {
|
||||||
|
|||||||
@@ -178,7 +178,6 @@ func (p *ParticipantImpl) sendIceCandidate(c *webrtc.ICECandidate, target liveki
|
|||||||
// write candidate
|
// write candidate
|
||||||
p.params.Logger.Debugw("sending ice candidates",
|
p.params.Logger.Debugw("sending ice candidates",
|
||||||
"candidate", c.String(), "target", target)
|
"candidate", c.String(), "target", target)
|
||||||
ci.Candidate += fmt.Sprintf(" network-cost %d", p.networkCost)
|
|
||||||
trickle := ToProtoTrickle(ci)
|
trickle := ToProtoTrickle(ci)
|
||||||
trickle.Target = target
|
trickle.Target = target
|
||||||
_ = p.writeMessage(&livekit.SignalResponse{
|
_ = p.writeMessage(&livekit.SignalResponse{
|
||||||
|
|||||||
Reference in New Issue
Block a user