Sfu/buffer stats for telemetry (#173)

* more buffer stats for analytics

* update names

* fix jitter and lost rate

* don't return on participantLeft if they never published
This commit is contained in:
David Colburn
2021-11-09 02:06:07 -06:00
committed by GitHub
parent c5830f9060
commit bf46e998b2
9 changed files with 295 additions and 191 deletions
+8 -8
View File
@@ -6,9 +6,6 @@ import (
"sync/atomic"
"time"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/livekit-server/pkg/sfu/twcc"
"github.com/livekit/protocol/logger"
livekit "github.com/livekit/protocol/proto"
"github.com/livekit/protocol/utils"
@@ -18,6 +15,9 @@ import (
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/livekit-server/pkg/sfu/buffer"
"github.com/livekit/livekit-server/pkg/sfu/twcc"
"github.com/livekit/livekit-server/pkg/telemetry"
)
@@ -127,7 +127,7 @@ func (t *MediaTrack) SetMuted(muted bool) {
if t.receiver != nil {
t.receiver.SetUpTrackPaused(muted)
}
// mute all of the subscribedtracks
// mute all subscribed tracks
for _, st := range t.subscribedTracks {
st.SetPublisherMuted(muted)
}
@@ -247,7 +247,7 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
delete(t.subscribedTracks, sub.ID())
t.lock.Unlock()
t.params.Telemetry.UnsubscribedTrack(sub.ID(), sub.Identity(), t.ToProto())
t.params.Telemetry.TrackUnsubscribed(sub.ID(), sub.Identity(), t.ToProto())
// ignore if the subscribing sub is not connected
if sub.SubscriberPC().ConnectionState() == webrtc.PeerConnectionStateClosed {
@@ -293,7 +293,7 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
sub.Negotiate()
}()
t.params.Telemetry.SubscribedTrack(sub.ID(), sub.Identity(), t.ToProto())
t.params.Telemetry.TrackSubscribed(sub.ID(), sub.Identity(), t.ToProto())
return nil
}
@@ -367,12 +367,12 @@ func (t *MediaTrack) AddReceiver(receiver *webrtc.RTPReceiver, track *webrtc.Tra
onclose := t.onClose
t.lock.Unlock()
t.RemoveAllSubscribers()
t.params.Telemetry.UnpublishedTrack(t.params.ParticipantID, t.params.ParticipantIdentity, t.ToProto())
t.params.Telemetry.TrackUnpublished(t.params.ParticipantID, t.params.ParticipantIdentity, t.ToProto(), uint32(track.SSRC()))
if onclose != nil {
onclose()
}
})
t.params.Telemetry.PublishedTrack(t.params.ParticipantID, t.params.ParticipantIdentity, t.ToProto())
t.params.Telemetry.TrackPublished(t.params.ParticipantID, t.params.ParticipantIdentity, t.ToProto(), buff)
if t.Kind() == livekit.TrackType_AUDIO {
t.buffer = buff