( identity livekit.ParticipantIdentity, pID livekit.ParticipantID, reason types.ParticipantCloseReason, )
| 1394 | } |
| 1395 | |
| 1396 | func (r *Room) RemoveParticipant( |
| 1397 | identity livekit.ParticipantIdentity, |
| 1398 | pID livekit.ParticipantID, |
| 1399 | reason types.ParticipantCloseReason, |
| 1400 | ) { |
| 1401 | r.lock.Lock() |
| 1402 | p, ok := r.participants[identity] |
| 1403 | if !ok { |
| 1404 | r.lock.Unlock() |
| 1405 | return |
| 1406 | } |
| 1407 | |
| 1408 | if pID != "" && p.ID() != pID { |
| 1409 | // participant session has been replaced |
| 1410 | r.lock.Unlock() |
| 1411 | return |
| 1412 | } |
| 1413 | |
| 1414 | agentJob := r.agentParticpants[identity] |
| 1415 | |
| 1416 | delete(r.participants, identity) |
| 1417 | delete(r.participantOpts, identity) |
| 1418 | delete(r.participantRequestSources, identity) |
| 1419 | delete(r.hasPublished, identity) |
| 1420 | delete(r.agentParticpants, identity) |
| 1421 | if !p.Hidden() { |
| 1422 | r.protoRoom.NumParticipants-- |
| 1423 | } |
| 1424 | |
| 1425 | immediateChange := false |
| 1426 | if p.IsRecorder() { |
| 1427 | activeRecording := false |
| 1428 | for _, op := range r.participants { |
| 1429 | if op.IsRecorder() { |
| 1430 | activeRecording = true |
| 1431 | break |
| 1432 | } |
| 1433 | } |
| 1434 | |
| 1435 | if r.protoRoom.ActiveRecording != activeRecording { |
| 1436 | r.protoRoom.ActiveRecording = activeRecording |
| 1437 | immediateChange = true |
| 1438 | } |
| 1439 | } |
| 1440 | r.lock.Unlock() |
| 1441 | r.protoProxy.MarkDirty(immediateChange) |
| 1442 | |
| 1443 | if !p.HasConnected() { |
| 1444 | fields := append( |
| 1445 | connectionDetailsFields(p.GetICEConnectionInfo()), |
| 1446 | "reason", reason.String(), |
| 1447 | "clientInfo", logger.Proto(sutils.ClientInfoWithoutAddress(p.GetClientInfo())), |
| 1448 | ) |
| 1449 | p.GetLogger().Infow("removing participant without connection", fields...) |
| 1450 | } |
| 1451 | |
| 1452 | // send broadcast only if it's not already closed |
| 1453 | sendUpdates := !p.IsDisconnected() |
no test coverage detected