Tweaks to reduce supervisor error logs (#1039)
Seeing some supervisor error logs under two conditions - Issuing a full reconnect - client should close this session and form a new one. So, supervisor errors on the to be closed session is not useful. - Some times it takes a long time for publisher PC to establish. If publish monitor timer stars when a pending track is added, the time out fires before ICE/DTLS is established. So, include a condition to start timer on publication monitor only after peer connection is connected.
This commit is contained in:
@@ -21,9 +21,10 @@ type ParticipantSupervisorParams struct {
|
||||
type ParticipantSupervisor struct {
|
||||
params ParticipantSupervisorParams
|
||||
|
||||
lock sync.RWMutex
|
||||
publications map[livekit.TrackID]types.OperationMonitor
|
||||
subscriptions map[livekit.TrackID]types.OperationMonitor
|
||||
lock sync.RWMutex
|
||||
isPublisherConnected bool
|
||||
publications map[livekit.TrackID]types.OperationMonitor
|
||||
subscriptions map[livekit.TrackID]types.OperationMonitor
|
||||
|
||||
isStopped atomic.Bool
|
||||
}
|
||||
@@ -44,11 +45,27 @@ func (p *ParticipantSupervisor) Stop() {
|
||||
p.isStopped.Store(true)
|
||||
}
|
||||
|
||||
func (p *ParticipantSupervisor) SetPublisherPeerConnectionConnected(isConnected bool) {
|
||||
p.lock.Lock()
|
||||
p.isPublisherConnected = isConnected
|
||||
|
||||
for _, pm := range p.publications {
|
||||
pm.PostEvent(types.OperationMonitorEventPublisherPeerConnectionConnected, p.isPublisherConnected)
|
||||
}
|
||||
p.lock.Unlock()
|
||||
}
|
||||
|
||||
func (p *ParticipantSupervisor) AddPublication(trackID livekit.TrackID) {
|
||||
p.lock.Lock()
|
||||
pm, ok := p.publications[trackID]
|
||||
if !ok {
|
||||
pm = NewPublicationMonitor(PublicationMonitorParams{TrackID: trackID, Logger: p.params.Logger})
|
||||
pm = NewPublicationMonitor(
|
||||
PublicationMonitorParams{
|
||||
TrackID: trackID,
|
||||
IsPeerConnectionConnected: p.isPublisherConnected,
|
||||
Logger: p.params.Logger,
|
||||
},
|
||||
)
|
||||
p.publications[trackID] = pm
|
||||
}
|
||||
pm.PostEvent(types.OperationMonitorEventAddPendingPublication, nil)
|
||||
|
||||
Reference in New Issue
Block a user