Compute delta stats to send downstream (#426)

* Compute delta stats to send downstream

Signed-off-by: shishir gowda <shishir@livekit.io>

* Update tests: total_packets should be diff between 2 packets

First packet was 1, second was 4. diff should be 3

Signed-off-by: shishir gowda <shishir@livekit.io>

* If there are no videoLayers, do not sent in Stats

For audio and Downstream tracks, we do not  get layers

Signed-off-by: shishir gowda <shishir@livekit.io>

* Use prev Max layer for current delta and update layer info for next round
This commit is contained in:
shishirng
2022-02-09 20:45:53 -05:00
committed by GitHub
parent 837f64643f
commit 6f7e6c4556
2 changed files with 206 additions and 38 deletions
+1 -1
View File
@@ -226,7 +226,7 @@ func Test_PacketLostDiffShouldBeSentToTelemetry(t *testing.T) {
_, stats = fixture.analytics.SendStatsArgsForCall(1)
require.Equal(t, 1, len(stats))
require.Equal(t, livekit.StreamType_DOWNSTREAM, stats[0].Kind)
require.Equal(t, 4, int(stats[0].Streams[0].TotalPacketsLost)) // see diff of TotalLost between pkts2 and pkts1
require.Equal(t, 3, int(stats[0].Streams[0].TotalPacketsLost)) // see diff of TotalLost between pkts2 and pkts1
}
func Test_OnDownStreamRTCP_SeveralTracks(t *testing.T) {