Increase size of RTCP channel just to be safe. (#641)

Also, using select to log warnings when queue is full.
This commit is contained in:
Raja Subramanian
2022-04-21 12:21:21 +05:30
committed by GitHub
parent 3f9d6c11bc
commit 2b6a304b27
2 changed files with 16 additions and 4 deletions
+11 -3
View File
@@ -147,7 +147,7 @@ func NewParticipant(params ParticipantParams) (*ParticipantImpl, error) {
}
p := &ParticipantImpl{
params: params,
rtcpCh: make(chan []rtcp.Packet, 50),
rtcpCh: make(chan []rtcp.Packet, 100),
pendingTracks: make(map[string]*pendingTrackInfo),
subscribedTracks: make(map[livekit.TrackID]types.SubscribedTrack),
subscribedTracksSettings: make(map[livekit.TrackID]*livekit.UpdateTrackSettings),
@@ -1468,7 +1468,7 @@ func (p *ParticipantImpl) mediaTrackReceived(track *webrtc.TrackRemote, rtpRecei
if p.twcc == nil {
p.twcc = twcc.NewTransportWideCCResponder(ssrc)
p.twcc.OnFeedback(func(pkt rtcp.RawPacket) {
p.rtcpCh <- []rtcp.Packet{&pkt}
p.postRtcp([]rtcp.Packet{&pkt})
})
}
p.pendingTracksLock.Unlock()
@@ -1506,7 +1506,7 @@ func (p *ParticipantImpl) hasPendingMigratedTrack() bool {
}
func (p *ParticipantImpl) onUpTrackManagerClose() {
p.rtcpCh <- nil
p.postRtcp(nil)
}
func (p *ParticipantImpl) getPendingTrack(clientId string, kind livekit.TrackType) (string, *livekit.TrackInfo) {
@@ -1659,3 +1659,11 @@ func (p *ParticipantImpl) incActiveCounter() {
p.updateState(livekit.ParticipantInfo_ACTIVE)
}
}
func (p *ParticipantImpl) postRtcp(pkts []rtcp.Packet) {
select {
case p.rtcpCh <- pkts:
default:
p.params.Logger.Warnw("rtcp channel full", nil)
}
}
+5 -1
View File
@@ -354,7 +354,11 @@ func (s *StreamAllocator) postEvent(event Event) {
return
}
s.eventCh <- event
select {
case s.eventCh <- event:
default:
s.params.Logger.Warnw("event queue full", nil)
}
s.eventChMu.RUnlock()
}