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) {
|
downTrack.OnPacketSent(func(_ *sfu.DownTrack, size int) {
|
||||||
t.params.Telemetry.OnDownstreamPacket(sub.ID(), size)
|
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) {
|
downTrack.OnRTCP(func(pkts []rtcp.Packet) {
|
||||||
t.params.Telemetry.HandleRTCP(livekit.StreamType_DOWNSTREAM, sub.ID(), pkts)
|
t.params.Telemetry.HandleRTCP(livekit.StreamType_DOWNSTREAM, sub.ID(), pkts)
|
||||||
})
|
})
|
||||||
|
|||||||
+10
-6
@@ -120,6 +120,9 @@ type DownTrack struct {
|
|||||||
|
|
||||||
// packet sent callback
|
// packet sent callback
|
||||||
onPacketSent []func(dt *DownTrack, size int)
|
onPacketSent []func(dt *DownTrack, size int)
|
||||||
|
|
||||||
|
// padding packet sent callback
|
||||||
|
onPaddingSent []func(dt *DownTrack, size int)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDownTrack returns a DownTrack.
|
// NewDownTrack returns a DownTrack.
|
||||||
@@ -375,12 +378,9 @@ func (d *DownTrack) WritePaddingRTP(bytesToSend int) int {
|
|||||||
|
|
||||||
size := hdr.MarshalSize() + len(payload)
|
size := hdr.MarshalSize() + len(payload)
|
||||||
d.UpdatePaddingStats(uint32(size))
|
d.UpdatePaddingStats(uint32(size))
|
||||||
// LK-TOOD-START:
|
for _, f := range d.onPaddingSent {
|
||||||
// Maybe call onPacketSent callbacks? But, a couple of issues to think about
|
f(d, size)
|
||||||
// - Analytics - should padding bytes be counted?
|
}
|
||||||
// - StreamAllocator probing - should not include padding
|
|
||||||
// Maybe a separate callback for `onPaddingSent`?
|
|
||||||
// LK-TODO-END
|
|
||||||
|
|
||||||
// LK-TODO-START
|
// LK-TODO-START
|
||||||
// NACK buffer for these probe packets.
|
// 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)
|
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 {
|
func (d *DownTrack) IsDeficient() bool {
|
||||||
return d.forwarder.IsDeficient()
|
return d.forwarder.IsDeficient()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user