mirror of
https://github.com/livekit/livekit.git
synced 2026-03-31 04:35:40 +00:00
Count padding bytes in telemetry (#264)
Count padding bytes in telemetry outgoing total bytes
This commit is contained in:
@@ -267,6 +267,9 @@ func (t *MediaTrack) AddSubscriber(sub types.Participant) error {
|
||||
downTrack.OnPacketSent(func(_ *sfu.DownTrack, size int) {
|
||||
t.params.Telemetry.OnDownstreamPacket(sub.ID(), size)
|
||||
})
|
||||
downTrack.OnPaddingSent(func(_ *sfu.DownTrack, size int) {
|
||||
t.params.Telemetry.OnDownstreamPacket(sub.ID(), size)
|
||||
})
|
||||
downTrack.OnRTCP(func(pkts []rtcp.Packet) {
|
||||
t.params.Telemetry.HandleRTCP(livekit.StreamType_DOWNSTREAM, sub.ID(), pkts)
|
||||
})
|
||||
|
||||
@@ -120,6 +120,9 @@ type DownTrack struct {
|
||||
|
||||
// packet sent callback
|
||||
onPacketSent []func(dt *DownTrack, size int)
|
||||
|
||||
// padding packet sent callback
|
||||
onPaddingSent []func(dt *DownTrack, size int)
|
||||
}
|
||||
|
||||
// NewDownTrack returns a DownTrack.
|
||||
@@ -375,12 +378,9 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int) int {
|
||||
|
||||
size := hdr.MarshalSize() + len(payload)
|
||||
d.UpdatePaddingStats(uint32(size))
|
||||
// LK-TOOD-START:
|
||||
// Maybe call onPacketSent callbacks? But, a couple of issues to think about
|
||||
// - Analytics - should padding bytes be counted?
|
||||
// - StreamAllocator probing - should not include padding
|
||||
// Maybe a separate callback for `onPaddingSent`?
|
||||
// LK-TODO-END
|
||||
for _, f := range d.onPaddingSent {
|
||||
f(d, size)
|
||||
}
|
||||
|
||||
// LK-TODO-START
|
||||
// NACK buffer for these probe packets.
|
||||
@@ -510,6 +510,10 @@ func (d *DownTrack) OnPacketSent(fn func(dt *DownTrack, size int)) {
|
||||
d.onPacketSent = append(d.onPacketSent, fn)
|
||||
}
|
||||
|
||||
func (d *DownTrack) OnPaddingSent(fn func(dt *DownTrack, size int)) {
|
||||
d.onPaddingSent = append(d.onPaddingSent, fn)
|
||||
}
|
||||
|
||||
func (d *DownTrack) IsDeficient() bool {
|
||||
return d.forwarder.IsDeficient()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user