Intent to Implement & Ship: RTCRtpSender/RTCRtpReceiver.getStats()

65 views
Skip to first unread message

Henrik Boström

unread,
Mar 28, 2018, 4:40:14 AM3/28/18
to blink-dev
Contact emails

Spec

Motivation
Performing the stats selection algorithm returns a filtered set of stats (stats dictionaries spec), it is convenient to only get the relevant set of stats for the sender/receiver of interest because there can be a lot of unrelated stats returned by a full getStats() call.
We have already shipped "Promise<RTCStatsReport> getStats()" on RTCPeerConnection on Chrome, this change adds an "optional MediaStreamTrack? selector = null" argument to it and adds "Promise<RTCStatsReport> getStats()" to RTCRtpSender and RTCRtpReceiver (interfaces previously shipped without it).
The W3C working group for WebRTC has consensus about about adding this API. It is already shipped by Firefox (sender link, receiver link, pc link).

Compatibility Risk
Low. This adds APIs without removing anything and there is already Firefox support for them.
There already exist a "void getStats(callback, optional selector)" API in Chrome but there is no way to confuse a callback with a MediaStreamTrack in terms of whether to call the legacy or spec-compliant version of RTCPeerConnection.getStats().

Ongoing technical constraints
None. This is already implemented behind flag, CLs going through the CQ.

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)? Yes or no.
Yes.

Launch tracking bug

Link to entry on the Chrome Platform Status

Requesting approval to ship?
Yes.

I will ship all three APIs at the same time:
- RTCPeerConnection.getStats(optional MediaStreamTrack? selector = null)
- RTCRtpSender.getStats()
- RTCRtpReceiver.getStats())
Target milestone: M67.

Chris Harrelson

unread,
Mar 29, 2018, 1:39:15 PM3/29/18
to Henrik Boström, blink-dev
Hi,

This intent looks pretty good. One question: are there any WPT tests for this intent?

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/59118d04-6611-41d4-aa3d-094c5ba4b281%40chromium.org.

Alex Russell

unread,
Mar 29, 2018, 1:41:02 PM3/29/18
to blink-dev
LGTM with nits: it seems like this would be an oft-requested feature from developers. Do we really not have any feedback to point to that motivated this addition?

Philipp Hancke

unread,
Mar 29, 2018, 2:35:31 PM3/29/18
to Alex Russell, blink-dev
its an optimization. Currently you would call peerConnection.getStats() which gives you the full set of statistics where you iterate and filter based on type this gives you reduced set to start with.
shows a use-case. Since here we're only interested in the number of bytes sent for audio, one could ask the rtpsender instead.

Long-term this will allow for a more efficient implementation in the browser but first developers need to start using this style. And as the sample also shows, get rid of chrome-legacy stats :-|

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/48269a64-f5f5-4ba5-945c-b8dc338709cc%40chromium.org.

Henrik Boström

unread,
Mar 29, 2018, 5:48:21 PM3/29/18
to blink-dev, hb...@chromium.org, chri...@chromium.org
Yes, there are existing WPT tests as well as new WPT added for this.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

Henrik Boström

unread,
Mar 29, 2018, 5:51:51 PM3/29/18
to blink-dev
I think it's positive but I don't have a citable reference. It gives a less bloated view of the stats and Firefox already has a selector, but like Philipp says this is a filter of existing stats. This is a convenient API but does not allow you to do new things that you could not already do with a full getStats() call.

Chris Harrelson

unread,
Mar 29, 2018, 6:14:23 PM3/29/18
to Henrik Boström, blink-dev
LGTM1

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/7eef7ddd-3575-4265-ab22-221b7d55cb41%40chromium.org.

Ojan Vafai

unread,
Apr 2, 2018, 5:52:18 PM4/2/18
to Chris Harrelson, Henrik Boström, blink-dev

Philip Jägenstedt

unread,
Apr 4, 2018, 7:55:02 AM4/4/18
to Ojan Vafai, Chris Harrelson, Henrik Boström, blink-dev
Reply all
Reply to author
Forward
0 new messages