Use RTT field in analytics stats (#304)

* Update protocol to v0.11.7

* Use RTT field in analytics stats

Instead of Delay
This commit is contained in:
Artur Shellunts
2021-12-30 13:13:40 +01:00
committed by GitHub
parent 07db1ba726
commit 6f84b36ccf
5 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ require (
github.com/google/wire v0.5.0
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/golang-lru v0.5.4
github.com/livekit/protocol v0.11.6
github.com/livekit/protocol v0.11.7
github.com/magefile/mage v1.11.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/mitchellh/go-homedir v1.1.0
+2 -2
View File
@@ -132,8 +132,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY/mKrcvA=
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
github.com/livekit/protocol v0.11.6 h1:F6WGwK/sDm7SfcDUln+6YlwmmWJT7gm6bXS8u6RmcyM=
github.com/livekit/protocol v0.11.6/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/livekit/protocol v0.11.7 h1:Rfd+7GE63d2W2505QroxGGFUxWkcLWqYR0z9dfrf1zU=
github.com/livekit/protocol v0.11.7/go.mod h1:YoHW9YbWbPnuVsgwBB4hAINKT+V68jmfh9zXBSSn6Wg=
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
+2 -2
View File
@@ -93,8 +93,8 @@ func (s *StatsWorker) OnRTCP(trackID livekit.TrackID, direction livekit.StreamTy
}
ds.totalPacketsLost = stats.PacketLost
if stats.Delay > ds.next.Delay {
ds.next.Delay = stats.Delay
if stats.Rtt > ds.next.Rtt {
ds.next.Rtt = stats.Rtt
}
if stats.Jitter > ds.next.Jitter {
ds.next.Jitter = stats.Jitter
+1 -1
View File
@@ -76,7 +76,7 @@ func (t *telemetryServiceInternal) HandleRTCP(streamType livekit.StreamType, par
if streamType == livekit.StreamType_DOWNSTREAM {
rtt := GetRttMs(pkt)
if rtt >= 0 {
stats.Delay = uint64(rtt)
stats.Rtt = uint32(rtt)
}
}
}
+2 -2
View File
@@ -155,7 +155,7 @@ func Test_OnDownStreamRTCP(t *testing.T) {
require.Equal(t, 1, int(stats[0].NackCount))
require.Equal(t, 1, int(stats[0].PliCount))
require.Equal(t, 1, int(stats[0].FirCount))
require.Equal(t, 0, int(stats[0].Delay)) // TODO: test for RTT
require.Equal(t, 0, int(stats[0].Rtt)) // TODO: test for RTT
require.Equal(t, 5, int(stats[0].Jitter)) // max of jitter, see list of rtcp.ReceptionReport above
require.Equal(t, 4, int(stats[0].PacketLost)) // last reported packets lost, see list of rtcp.ReceptionReport above
require.Equal(t, trackID, stats[0].TrackId)
@@ -290,7 +290,7 @@ func Test_OnUpstreamRTCP(t *testing.T) {
require.Equal(t, 1, int(stats[0].NackCount))
require.Equal(t, 1, int(stats[0].PliCount))
require.Equal(t, 1, int(stats[0].FirCount))
require.Equal(t, 0, int(stats[0].Delay)) // TODO: test for RTT
require.Equal(t, 0, int(stats[0].Rtt)) // TODO: test for RTT
require.Equal(t, 5, int(stats[0].Jitter)) // max of jitter, see list of rtcp.ReceptionReport above
require.Equal(t, 4, int(stats[0].PacketLost)) // last reported packets lost, see list of rtcp.ReceptionReport above
require.Equal(t, trackID, stats[0].TrackId)