improve participant hidden (#2220)
This commit is contained in:
@@ -139,6 +139,7 @@ type ParticipantImpl struct {
|
|||||||
resSinkMu sync.Mutex
|
resSinkMu sync.Mutex
|
||||||
resSink routing.MessageSink
|
resSink routing.MessageSink
|
||||||
grants *auth.ClaimGrants
|
grants *auth.ClaimGrants
|
||||||
|
hidden atomic.Bool
|
||||||
isPublisher atomic.Bool
|
isPublisher atomic.Bool
|
||||||
|
|
||||||
// when first connected
|
// when first connected
|
||||||
@@ -249,6 +250,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
|
|||||||
p.migrateState.Store(types.MigrateStateInit)
|
p.migrateState.Store(types.MigrateStateInit)
|
||||||
p.state.Store(livekit.ParticipantInfo_JOINING)
|
p.state.Store(livekit.ParticipantInfo_JOINING)
|
||||||
p.grants = params.Grants
|
p.grants = params.Grants
|
||||||
|
p.hidden.Store(p.grants.Video.Hidden)
|
||||||
p.SetResponseSink(params.Sink)
|
p.SetResponseSink(params.Sink)
|
||||||
p.setupEnabledCodecs(params.PublishEnabledCodecs, params.SubscribeEnabledCodecs, params.ClientConf.GetDisabledCodecs())
|
p.setupEnabledCodecs(params.PublishEnabledCodecs, params.SubscribeEnabledCodecs, params.ClientConf.GetDisabledCodecs())
|
||||||
|
|
||||||
@@ -426,6 +428,7 @@ func (p *ParticipantImpl) SetPermission(permission *livekit.ParticipantPermissio
|
|||||||
p.params.Logger.Infow("updating participant permission", "permission", permission)
|
p.params.Logger.Infow("updating participant permission", "permission", permission)
|
||||||
|
|
||||||
video.UpdateFromPermission(permission)
|
video.UpdateFromPermission(permission)
|
||||||
|
p.hidden.Store(permission.Hidden)
|
||||||
p.dirty.Store(true)
|
p.dirty.Store(true)
|
||||||
|
|
||||||
canPublish := video.GetCanPublish()
|
canPublish := video.GetCanPublish()
|
||||||
@@ -1021,10 +1024,7 @@ func (p *ParticipantImpl) CanPublishData() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *ParticipantImpl) Hidden() bool {
|
func (p *ParticipantImpl) Hidden() bool {
|
||||||
p.lock.RLock()
|
return p.hidden.Load()
|
||||||
defer p.lock.RUnlock()
|
|
||||||
|
|
||||||
return p.grants.Video.Hidden
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ParticipantImpl) IsRecorder() bool {
|
func (p *ParticipantImpl) IsRecorder() bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user