Search code examples
latencywebrtc

How to calculate latency (or delay) from statistics?


I would to calculate latency time of a running audio/video call.

According to these parameters of RTCStatsReport object, how can I retrieve the delay time?

latency = packetsize / delay + bandwidth 

Solution

  • I think what you want is the RTT (round-trip time), which is available as "googRtt" in Chrome. You can see it if you go to chrome://webrtc-internals or you can get it programmatically via the stats interface: https://webrtc.github.io/samples/src/content/peerconnection/constraints/ (click the capture and connect button and then scroll down to the statistics).

    Note that two of the reports should have googRtt in them: one is for audio and the other for video.