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:
Raja Subramanian
2022-09-27 08:20:06 +05:30
committed by GitHub
parent 123baa571b
commit b3e148771a
4 changed files with 51 additions and 10 deletions
+21 -4
View File
@@ -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)