MCPcopy
hub / github.com/livekit/livekit / SendParticipantUpdates

Function SendParticipantUpdates

pkg/rtc/room.go:2284–2323  ·  view source on GitHub ↗
(updates []*ParticipantUpdate, participants []types.LocalParticipant, batchTargetSize int)

Source from the content-addressed store, hash-verified

2282}
2283
2284func 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()
2326func GetOtherParticipantInfo(

Callers 2

changeUpdateWorkerMethod · 0.85

Calls 6

IsCloseNotifySkippableFunction · 0.85
ChunkProtoBatchFunction · 0.85
ProtocolVersionMethod · 0.65
SendParticipantUpdateMethod · 0.65
GetLoggerMethod · 0.65

Tested by

no test coverage detected