Guard against ParticipantUpdate sent before JoinResponse (#1271)
* Guard against ParticipantUpdate sent before JoinResponse
This commit is contained in:
@@ -909,13 +909,17 @@ func (p *ParticipantImpl) UpdateSubscribedTrackSettings(trackID livekit.TrackID,
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) VerifySubscribeParticipantInfo(pID livekit.ParticipantID, version uint32) {
|
||||
if !p.IsReady() {
|
||||
// we have not sent a JoinResponse yet. metadata would be covered in JoinResponse
|
||||
return
|
||||
}
|
||||
if v, ok := p.updateCache.Get(pID); ok && v >= version {
|
||||
return
|
||||
}
|
||||
|
||||
if f := p.params.GetParticipantInfo; f != nil {
|
||||
if info := f(pID); info != nil {
|
||||
p.SendParticipantUpdate([]*livekit.ParticipantInfo{info})
|
||||
_ = p.SendParticipantUpdate([]*livekit.ParticipantInfo{info})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1187,11 +1191,6 @@ func (p *ParticipantImpl) updateState(state livekit.ParticipantInfo_State) {
|
||||
|
||||
// when the server has an offer for participant
|
||||
func (p *ParticipantImpl) onSubscriberOffer(offer webrtc.SessionDescription) error {
|
||||
if p.State() == livekit.ParticipantInfo_DISCONNECTED {
|
||||
// skip when disconnected
|
||||
return nil
|
||||
}
|
||||
|
||||
p.params.Logger.Infow("sending offer", "transport", livekit.SignalTarget_SUBSCRIBER)
|
||||
return p.writeMessage(&livekit.SignalResponse{
|
||||
Message: &livekit.SignalResponse_Offer{
|
||||
|
||||
Reference in New Issue
Block a user