Use microseconds for forwarding stats. (#3943)

Latency is always 0, but jitter is high.
Not sure how that happens as latency is the welford mean and jitter is
welford standard deviation. Feels like some mis-labeling.

Anyhow, switching to microseconds units to get better resolution.
This commit is contained in:
Raja Subramanian
2025-09-23 02:28:19 +05:30
committed by GitHub
parent 856e0871bc
commit 6a41fae548
2 changed files with 10 additions and 17 deletions
+2 -1
View File
@@ -29,6 +29,7 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/mono"
"github.com/livekit/livekit-server/pkg/sfu/audio"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
@@ -826,7 +827,7 @@ func (w *WebRTCReceiver) forwardRTP(layer int32, buff *buffer.Buffer) {
// track delay/jitter
if writeCount > 0 && w.forwardStats != nil {
w.forwardStats.Update(pkt.Arrival, time.Now().UnixNano())
w.forwardStats.Update(pkt.Arrival, mono.UnixNano())
}
// track video layers