Admin APIs for participant management (#13)

* stubs for room admin APIs

* room store APIs to persist participants

* participant persistence

* updated protobufs

* implemented APIs to mute/remove/etc

* fixed mute handling
This commit is contained in:
David Zhao
2021-02-10 00:06:32 -08:00
committed by GitHub
parent 61b9569e38
commit 38140debdf
30 changed files with 3016 additions and 289 deletions
+18 -7
View File
@@ -358,6 +358,16 @@ func (p *ParticipantImpl) Close() error {
// already closed
return nil
}
// remove all downtracks
p.lock.Lock()
for _, t := range p.publishedTracks {
// skip updates
t.OnClose(nil)
t.RemoveAllSubscribers()
}
p.lock.Unlock()
p.updateState(livekit.ParticipantInfo_DISCONNECTED)
p.onICECandidate = nil
p.peerConn.OnDataChannel(nil)
@@ -437,16 +447,17 @@ func (p *ParticipantImpl) SetTrackMuted(trackId string, muted bool) {
defer p.lock.RUnlock()
track := p.publishedTracks[trackId]
if track == nil {
logger.Warnw("could not locate track", "track", trackId)
return
}
updated := false
currentMuted := track.IsMuted()
track.SetMuted(muted)
switch t := track.(type) {
case *MediaTrack:
updated = t.muted.TrySet(muted)
}
if updated && p.onTrackUpdated != nil {
if currentMuted != track.IsMuted() && p.onTrackUpdated != nil {
logger.Debugw("mute status changed",
"participant", p.identity,
"track", trackId,
"muted", track.IsMuted())
p.onTrackUpdated(p, track)
}
}