(updates []*ParticipantUpdate, participants []types.LocalParticipant, batchTargetSize int)
| 2282 | } |
| 2283 | |
| 2284 | func SendParticipantUpdates(updates []*ParticipantUpdate, participants []types.LocalParticipant, batchTargetSize int) { |
| 2285 | if len(updates) == 0 { |
| 2286 | return |
| 2287 | } |
| 2288 | |
| 2289 | // For filtered updates, skip |
| 2290 | // 1. synthesized DISCONNECT - this happens on SID change |
| 2291 | // 2. close reasons of DUPLICATE_IDENTITY/STALE - A newer session for that identity exists. |
| 2292 | // |
| 2293 | // Filtered updates are used with clients that can handle identity based reconnect and hence those |
| 2294 | // conditions can be skipped. |
| 2295 | var filteredUpdates []*livekit.ParticipantInfo |
| 2296 | for _, update := range updates { |
| 2297 | if update.IsSynthesizedDisconnect || IsCloseNotifySkippable(update.CloseReason) { |
| 2298 | continue |
| 2299 | } |
| 2300 | filteredUpdates = append(filteredUpdates, update.ParticipantInfo) |
| 2301 | } |
| 2302 | |
| 2303 | var fullUpdates []*livekit.ParticipantInfo |
| 2304 | for _, update := range updates { |
| 2305 | fullUpdates = append(fullUpdates, update.ParticipantInfo) |
| 2306 | } |
| 2307 | |
| 2308 | filteredUpdateChunks := ChunkProtoBatch(filteredUpdates, batchTargetSize) |
| 2309 | fullUpdateChunks := ChunkProtoBatch(fullUpdates, batchTargetSize) |
| 2310 | |
| 2311 | for _, op := range participants { |
| 2312 | updateChunks := fullUpdateChunks |
| 2313 | if op.ProtocolVersion().SupportsIdentityBasedReconnection() { |
| 2314 | updateChunks = filteredUpdateChunks |
| 2315 | } |
| 2316 | for _, chunk := range updateChunks { |
| 2317 | if err := op.SendParticipantUpdate(chunk); err != nil { |
| 2318 | op.GetLogger().Errorw("could not send update to participant", err) |
| 2319 | break |
| 2320 | } |
| 2321 | } |
| 2322 | } |
| 2323 | } |
| 2324 | |
| 2325 | // GetOtherParticipantInfo returns ParticipantInfo for everyone in the room except for the participant identified by lp.Identity() |
| 2326 | func GetOtherParticipantInfo( |
no test coverage detected