move consts.

This commit is contained in:
Miroslav Šedivý 2023-04-17 01:21:32 +02:00
parent 3f375c037f
commit 5a2fcc1c8a
3 changed files with 10 additions and 5 deletions

View File

@ -44,9 +44,6 @@ const (
// send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval // send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval
rtcpPLIInterval = 3 * time.Second 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 { func New(desktop types.DesktopManager, capture types.CaptureManager, config *config.WebRTC) *WebRTCManagerCtx {

View File

@ -11,7 +11,10 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto" "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 { type metricsManager struct {
mu sync.Mutex mu sync.Mutex

View File

@ -17,6 +17,11 @@ import (
"github.com/demodesk/neko/pkg/types/message" "github.com/demodesk/neko/pkg/types/message"
) )
const (
// how often to read and process bandwidth estimation reports
estimatorReadInterval = 250 * time.Millisecond
)
type WebRTCPeerCtx struct { type WebRTCPeerCtx struct {
mu sync.Mutex mu sync.Mutex
logger zerolog.Logger logger zerolog.Logger
@ -115,7 +120,7 @@ func (peer *WebRTCPeerCtx) estimatorReader() {
} }
// use a ticker to get current client target bitrate // use a ticker to get current client target bitrate
ticker := time.NewTicker(bitrateCheckInterval) ticker := time.NewTicker(estimatorReadInterval)
defer ticker.Stop() defer ticker.Stop()
for range ticker.C { for range ticker.C {