Learn about our integration with Amazon Connect here !

Verify the WebRTC getStats() API Output

by Pallab Gain,
19 June 2018

Verify the WebRTC getStats() API Output

The adoption of WebRTC in real-time communication is growing at an exponential rate, which makes WebRTC monitoring inevitable. To make sure WebRTC calls are at the best possible quality, developers can get started with the current standard for WebRTC statistics by using the getStats() API , a real-time Statistics API.

What is the getStats() API?

The statistics API provides access to the following 17 RTC statistics types across the complete WebRTC v1.0 media pipeline. To learn more, you can read our Basics of WebRTC getstats API blog.

enum RTCStatsType {
    "codec",
    "inbound-rtp",
    "outbound-rtp",
    "remote-inbound-rtp",
    "remote-outbound-rtp",
    "csrc",
    "peer-connection",
    "data-channel",
    "stream",
    "track",
    "sender",
    "receiver",
    "transport",
    "candidate-pair",
    "local-candidate",
    "remote-candidate",
    "certificate"
};

 

Implementation in Browsers

Web browsers have implemented some of these statistics, and the status of implementation is not very clear. Each browser releases a new version every 6 - 8 weeks, which means across Chrome, Firefox, Edge, Safari, Electron and WebView something is changing almost every week. With the continuous changes, it can be difficult for developers and the WebRTC community to keep track of the implementation for these statistics, especially when trying to identify browser and version-specific changes.

What is Verify webrtc-stats?

After identifying these challenges, we set up to build a real-time solution that can help WebRTC developers check the status of the WebRTC statistics implementation across different browser versions. callstats.io ‘Verify webrtc-stats’ is a new service dedicated to verifying the implementation of the getStats API() across browsers. The following use cases are currently supported:

  • Verify the statistics implementation for an audio only call across different browsers
  • Verify the statistics implementation for a video only call across different browsers

Immediately upon running webrtc-stats.callstats.io/verify, we noticed the nackCount is implemented in Chrome for Video only, but not for Audio. This is a bit odd, as there is a metric for one type of media stream and not the other. It is also a known issue in WebRTC and already reported as a bug. Forthcoming iterations will add more use cases (e.g., recording, screen sharing, etc).

nackCount implemented for video but not for audio in Chrome

Figure 1: nackCount implemented for video but not for audio in Chrome.

How and Why Did We Build It?

We use KITE as the testing engine to simulate use cases and to report the status of the implementation of the statistics to our service. You can compare different versions of the same browsers or different browsers. Before Kite, we had a daily statistics tester that checked the browsers on a daily basis. We built the daily stats-tester in 2015, because Varun (co-author of the specification) and our engineers have regular discussions on what is specified and what is implemented. With KITE, the maintainability of the stats-tester becomes easier, since the KITE community takes the responsibility to make sure the tests run across various browsers and different versions. We take responsibility for verifying the implementation status of webrtc-stats (getStats() API) is up to date.

Apart from verifying the implementation of the webrtc-statistics across browser, we are further extending the system to validate that measurements reported in the metrics are accurately calculated, measured, and reported by the browsers.

Interested in getting updates on when browsers implement new WebRTC stats?
Subscribe to the updates now.