diff --git a/internal/webrtc/manager.go b/internal/webrtc/manager.go index 74a4b2af..25b9de89 100644 --- a/internal/webrtc/manager.go +++ b/internal/webrtc/manager.go @@ -44,9 +44,6 @@ const ( // send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval rtcpPLIInterval = 3 * time.Second - - // how often we check the bitrate of each client. Default is 250ms - bitrateCheckInterval = 250 * time.Millisecond ) func New(desktop types.DesktopManager, capture types.CaptureManager, config *config.WebRTC) *WebRTCManagerCtx { diff --git a/internal/webrtc/metrics.go b/internal/webrtc/metrics.go index 513e86a4..79cbd620 100644 --- a/internal/webrtc/metrics.go +++ b/internal/webrtc/metrics.go @@ -11,7 +11,10 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" ) -var connectionStatsInterval = 5 * time.Second +const ( + // how often to read and process webrtc connection stats + connectionStatsInterval = 5 * time.Second +) type metricsManager struct { mu sync.Mutex diff --git a/internal/webrtc/peer.go b/internal/webrtc/peer.go index ddadb036..4e26f5d6 100644 --- a/internal/webrtc/peer.go +++ b/internal/webrtc/peer.go @@ -17,6 +17,11 @@ import ( "github.com/demodesk/neko/pkg/types/message" ) +const ( + // how often to read and process bandwidth estimation reports + estimatorReadInterval = 250 * time.Millisecond +) + type WebRTCPeerCtx struct { mu sync.Mutex logger zerolog.Logger @@ -115,7 +120,7 @@ func (peer *WebRTCPeerCtx) estimatorReader() { } // use a ticker to get current client target bitrate - ticker := time.NewTicker(bitrateCheckInterval) + ticker := time.NewTicker(estimatorReadInterval) defer ticker.Stop() for range ticker.C {