webrtc-stats icon indicating copy to clipboard operation
webrtc-stats copied to clipboard

RTCOutboundRtpStreamStats.headerBytesSent/totalPacketSendDelay and RTX seems underspecified

Open docfaraday opened this issue 2 years ago • 6 comments

Spec explicitly says that we should be totaling up packetsSent, bytesSent, retransmittedPacketsSent, and retransmittedBytesSent. But what about headerBytesSent/totalPacketSendDelay?

headerBytesSent

It seems pretty clear that this should include RTX, since spec says "headerBytesSent + bytesSent equals the number of bytes sent as payload over the transport.", and bytesSent accounts for RTX.

totalPacketSendDelay

This probably ought to account for RTX as well. The only way I can see this metric being useful is by comparing it to packetsSent (over some time window), and packetsSent includes RTX packets.

docfaraday avatar Mar 09 '23 15:03 docfaraday

retransmittedPacketsSent and retransmittedBytesSent are already included in packetsSent and bytesSent. So they should be include retransmissions. Unless I am missing something, the definitions are correct, however, based on the ticket, a clarification would help the implementor. Would the following improvements clarify the definitions:

headerBytesSent of type unsigned long long

Total number of RTP header and padding bytes sent for this SSRC. This does not include the size of transport layer headers such as IP or UDP. headerBytesSent includes retransmissions. Hence, headerBytesSent + bytesSent equals the number of bytes sent as payload over the transport.

For totalPacketSendDelay says the measurement is added each time the packetSent is incremented. And the packetSent explicitly states that it includes retransmissions. Would the following clarification help?

totalPacketSendDelay of type double

The total number of seconds that packets have spent buffered locally before being transmitted onto the network. The time is measured from when a packet is emitted from the RTP packetizer until it is handed over to the OS network socket. This measurement is added to totalPacketSendDelay when packetsSent is incremented. packetSent includes retransmitted packets, therefore, this measurement should be include send delays for retransmitted packets.

vr000m avatar Mar 15 '23 02:03 vr000m

Yeah, I think being explicit here is necessary.

docfaraday avatar Mar 15 '23 13:03 docfaraday

Will you provide a clarification PR @vr000m ? (I think we can merge such PRs even if #746 has yet to be resolved)

henbos avatar Mar 15 '23 14:03 henbos

How is this kind of stuff testable?

fippo avatar Apr 08 '23 10:04 fippo

I've checked what libWebRTC does as part of implementing RTX stats.

It does not include the payload of RTX packets, so the accurate thing to say would be:

headerBytesSent includes the header bytes of retransmissions

fippo avatar Apr 20 '23 18:04 fippo

Agree that the clarification is appropriate. Header bytes of retransmissions.

Can you confirm if the retransmission bytes are added to bytesSent?

vr000m avatar Apr 22 '23 07:04 vr000m