Expose IsPublisher and IsSubscribedTo via LocalParticipant interface (#772)
This commit is contained in:
+13
-9
@@ -435,7 +435,7 @@ func (p *ParticipantImpl) ToProto() *livekit.ParticipantInfo {
|
||||
Permission: p.grants.Video.ToPermission(),
|
||||
Metadata: p.grants.Metadata,
|
||||
Region: p.params.Region,
|
||||
IsPublisher: p.isPublisher.Load(),
|
||||
IsPublisher: p.IsPublisher(),
|
||||
}
|
||||
p.lock.RUnlock()
|
||||
info.Tracks = p.UpTrackManager.ToProto()
|
||||
@@ -828,6 +828,18 @@ func (p *ParticipantImpl) GetSubscribedParticipants() []livekit.ParticipantID {
|
||||
return participantIDs
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) IsSubscribedTo(participantID livekit.ParticipantID) bool {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
_, ok := p.subscribedTo[participantID]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) IsPublisher() bool {
|
||||
return p.isPublisher.Load()
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) CanPublish() bool {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
@@ -1362,14 +1374,6 @@ func (p *ParticipantImpl) configureReceiverDTX() {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) isSubscribedTo(participantID livekit.ParticipantID) bool {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
_, ok := p.subscribedTo[participantID]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) onStreamStateChange(update *sfu.StreamStateUpdate) error {
|
||||
if len(update.StreamStates) == 0 {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user