mirror of
https://github.com/livekit/livekit.git
synced 2026-03-30 15:35:41 +00:00
add log for unexpected jitter (#2752)
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
package sfu
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/utils"
|
||||
)
|
||||
|
||||
@@ -46,9 +48,17 @@ func (s *ForwardStats) Update(arrival, left time.Time) {
|
||||
|
||||
func (s *ForwardStats) GetStats() (latency, jitter time.Duration) {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
w := s.latency.Summarize()
|
||||
return time.Duration(w.Mean()), time.Duration(w.StdDev())
|
||||
s.lock.Unlock()
|
||||
latency, jitter = time.Duration(w.Mean()), time.Duration(w.StdDev())
|
||||
// TODO: remove this check after debugging unexpected jitter issue
|
||||
if jitter > 10*time.Second {
|
||||
logger.Infow("unexpected forward jitter",
|
||||
"jitter", jitter,
|
||||
"stats", fmt.Sprintf("count %.2f, mean %.2f, stdDev %.2f", w.Count(), w.Mean(), w.StdDev()),
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *ForwardStats) GetLastStats(duration time.Duration) (latency, jitter time.Duration) {
|
||||
|
||||
Reference in New Issue
Block a user