From 5a2fcc1c8a613b1888b72228c65ed19018fcef26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Mon, 17 Apr 2023 01:21:32 +0200 Subject: [PATCH] move consts. --- internal/webrtc/manager.go | 3 --- internal/webrtc/metrics.go | 5 ++++- internal/webrtc/peer.go | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) 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 {