Telemetry capture published track updates (#367)

* Telemetry capture published track updates

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

* Updated OnVideoLayerUpdate to take slice of layers

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

* Update proto dep

Signed-off-by: shishir gowda <shishir@livekit.io>
This commit is contained in:
shishirng
2022-01-24 14:38:04 -05:00
committed by GitHub
parent 90b97137c9
commit 56ebd521f9
7 changed files with 84 additions and 7 deletions
@@ -65,3 +65,36 @@ func Test_OnParticipantLeft_EventIsSent(t *testing.T) {
require.Equal(t, room.Sid, event.RoomId)
require.Equal(t, room, event.Room)
}
func Test_OnTrackUpdate_EventIsSent(t *testing.T) {
fixture := createFixture()
// prepare
partID := "part1"
trackID := "track1"
width := uint32(360)
height := uint32(720)
trackInfo := &livekit.TrackInfo{
Sid: trackID,
Type: livekit.TrackType_VIDEO,
Muted: false,
Width: width,
Height: height,
Simulcast: false,
DisableDtx: false,
}
// do
fixture.sut.TrackPublishedUpdate(context.Background(), livekit.ParticipantID(partID), trackInfo)
// test
require.Equal(t, 1, fixture.analytics.SendEventCallCount())
_, event := fixture.analytics.SendEventArgsForCall(0)
require.Equal(t, livekit.AnalyticsEventType_TRACK_PUBLISHED_UPDATE, event.Type)
require.Equal(t, partID, event.ParticipantId)
require.Equal(t, trackID, event.Track.Sid)
require.Equal(t, width, event.Track.Width)
require.Equal(t, height, event.Track.Height)
}