Fixes to sync state disabled tracks. (#2459)
* Fixes to sync state disabled tracks. * test
This commit is contained in:
+2
-23
@@ -649,7 +649,7 @@ func (r *Room) UpdateSubscriptions(
|
||||
|
||||
func (r *Room) SyncState(participant types.LocalParticipant, state *livekit.SyncState) error {
|
||||
pLogger := participant.GetLogger()
|
||||
pLogger.Infow("setting sync state", "state", state)
|
||||
pLogger.Infow("setting sync state", "state", logger.Proto(state))
|
||||
|
||||
shouldReconnect := false
|
||||
pubTracks := state.GetPublishTracks()
|
||||
@@ -690,28 +690,7 @@ func (r *Room) SyncState(participant types.LocalParticipant, state *livekit.Sync
|
||||
// can be set before addding subscriptions,
|
||||
// in fact it is done before so that setting can be updated immediately upon subscription.
|
||||
for _, trackSid := range state.TrackSidsDisabled {
|
||||
// skip if it is not present in the subscribe list
|
||||
found := false
|
||||
for _, sid := range state.Subscription.TrackSids {
|
||||
if sid == trackSid {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
participant_tracks:
|
||||
for _, pt := range state.Subscription.ParticipantTracks {
|
||||
for _, sid := range pt.TrackSids {
|
||||
if sid == trackSid {
|
||||
found = true
|
||||
break participant_tracks
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if found {
|
||||
participant.UpdateSubscribedTrackSettings(livekit.TrackID(trackSid), &livekit.UpdateTrackSettings{Disabled: true})
|
||||
}
|
||||
participant.UpdateSubscribedTrackSettings(livekit.TrackID(trackSid), &livekit.UpdateTrackSettings{Disabled: true})
|
||||
}
|
||||
|
||||
r.UpdateSubscriptions(
|
||||
|
||||
Reference in New Issue
Block a user