6

I have been trying to figure out a way to calculate the following: Bandwidth, Latency, Current Upload, and Download speed. And have been confused with the values I am getting for the INBOUND-RTP, OUTBOUND-RTP, & REMOTE-INBOUND-RTP.

In my head, I was thinking about inbound-rtp as a collection of stats for all incoming data. which apparently is wrong, since different stats for that type always stays Zero

The current setup uses chrome as a 2 connecting Clients, and a Media Server, with client instances running on "localhost"

enter image description here

Harshwardhan
  • 117
  • 1
  • 11

2 Answers2

17

The terminology used on MDN is a bit terse, so here's a rephrasing that I hope is helpful to solve your problem! Block quotes taken from MDN & clarified below. For an even terser description, also see the W3C definitions.

outbound-rtp

An RTCOutboundRtpStreamStats object giving statistics about an outbound RTP stream being sent from the RTCPeerConnection.

This stats report is based on your outgoing data stream to your peers. This is the measurement taken from the perspective of just that oubound RTP stream, which is why information that involves your peers (round trip time, jitter, etc.) is missing, because those can only be measured with an understanding of the peer's processing of your stream.

inbound-rtp

Statistics about an inbound RTP stream that's currently in use by this RTCPeerConnection, in an RTCInboundRtpStreamStats object.

By contrast to the Outbound RTP statistics, this stats report contains data about the inbound data stream you are receiving from your peer(s). Notice that if you do not have any connected peers your call to getStats does not include this report type at all.

remote-inbound-rtp

Contains statistics about the remote endpoint's inbound RTP stream; that stream corresponds to the local endpoint's outbound RTP stream. Using this RTCRemoteInboundRtpStreamStats object, you can learn how the well the remote peer is receiving data.

This stats report provides details about your outbound rtp stream from the perspective of the remote connection. That is to say that this stats report provides an analysis about your outbound-rtp stream from the perspective of the remote server that is handling your stream on the other side.

Ben
  • 216
  • 3
  • 4
  • Thanks for that explanation @Ben Can you help me understand which one of these stats I should factor for latency. Does Round trip time directly relates to the network latency? – Harshwardhan Feb 26 '20 at 09:19
  • 2
    @Harshwardhan from what I understand, yes; I did have a source for this which clarified that RTT = latency, but I can't seem to find it now. If I'm able to get that, I'll post an update! – Ben Feb 26 '20 at 12:32
  • 1
    did you found anything? – Harshwardhan Mar 05 '20 at 18:59
  • any progress with the latency formula.cheers. – desperado06 Aug 01 '22 at 12:37
5

I'm on the MDN writing team at Mozilla and happened upon this just now. I've taken some of the information from this conversation and applied it back to the article about RTCStatsType. There's more to improve there still, but I wanted to thank you for that insight!

Always feel free to sign up for an MDN account and update any content you see that's inaccurate or incomplete! Or you can file an issue and we'll see what we can do.

Eric Shepherd
  • 186
  • 1
  • 5