Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTCStatsReport - add stats-type features and stats #18910

Merged
merged 17 commits into from
Apr 28, 2023

Conversation

hamishwillee
Copy link
Contributor

@hamishwillee hamishwillee commented Feb 14, 2023

This PR updates RTCStatsReport to include returned stats, sorted by type_ key. It combines data from:

The BCD collector resulted in a large number of ranged values. In order to get this in:

  • In one commit
    • all ranged values in derived platforms have been set to mirrored. (e.g. android platforms, safari ios, edge, ff android
    • ranged values like Chrome >= 80 were modified to be precise Chrome = 80.
  • In next commit:
    • Fixed up the parent type_ range to the minimum for contained subfeatures.

The ranged value commit was done separately so should be easy to review.


FF Data

Fixes #6879.

@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Feb 14, 2023
@hamishwillee hamishwillee changed the title Rtc inbound rtp stream stats RTCInboundRtpStreamStats.trackIdentifier + the whole dictionary Feb 14, 2023
@hamishwillee
Copy link
Contributor Author

@queengooborg I have updated the FF results using searchfox and bugzill - it turns out the IDL is quite accurate at working out what is supported. Also added a few values from various Chrome notes around the place.
But vast majority for Safari and Chrome I can't work out - it isn't just bisecting, some require specialist setup.

We can guess for some of them using data from here: https://webrtc-stats.callstats.io/verify/ i.e. use the tested versions as introduced versions. For Chrome at least that is probably reasonable, because most of this came in on the reported version M79/8 as far as I can tell.

Advicde appreciated.

@hamishwillee
Copy link
Contributor Author

Actually, maybe I can reasonably bisect using a combination of https://wpt.live/webrtc-stats/supported-stats.https.html and https://webrtc-stats.callstats.io/verify/

@hamishwillee hamishwillee force-pushed the RTCInboundRtpStreamStats branch from 6dc54d0 to 6777c45 Compare February 24, 2023 05:23
Comment on lines 1557 to 1560
"inbound_rtp_frameHeight": {
"__compat": {
"description": "<code>frameHeight</code> in 'inbound-rtp' stats",
"spec_url": "https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-frameheight",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@queengooborg This is the start of what is going to replace RTCInbountRtpStreamStats. My current plan is to do all the values like this - so all inbounds will be inbound_rtp_Xxxx and there will be keys for outbound_rtp_Xxxx and so on that will be peers.

Do you think this is OK? Or should we have deeper grouping - e.g. a feature inbound_rtp and fields below it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, we can always make changes to the structure in the future if we need to!

@hamishwillee
Copy link
Contributor Author

@queengooborg Not as much success as I'd hoped:

  1. Browserstack
  2. So what I have here is a BCD with
    • features for all stats in the test and spec, with spec links
    • All values are true, false, or a particular value.
    • True means "supported in earliest version I could test" (FF that is 110, for chrome 80, for Safari iOS latest) OR,
    • for FF it means I found additional info in bugzilla. Some of this info is a bit confusing. I suspect that some of the stuff went in earlier.
  3. Summary of testing so far here: https://docs.google.com/spreadsheets/d/12N5lcpT8DUqiL7G7wyocYgf5OAeYfUQHKO6OwflZos8/edit?usp=sharing

I think we are going to have little choice but to mark things as either "true" or better ">=Version" for the unknown cases and add an exception. That is not great, but it is better than what we have by a mile, and will get progressively better as time goes on.

Thoughts? If not, I need direction.

@queengooborg queengooborg self-assigned this Mar 2, 2023
@queengooborg
Copy link
Contributor

I'm going to mark this as blocked on #19014. We're going to need to spend a lot of time researching this to determine the proper version numbers, and it doesn't align with the 2020+ data goal so I'm not sure we can justify the research time right now (even though it's a part of our dictionary removals goal).

@queengooborg queengooborg added not ready This is not yet ready to be merged. It's pending a decision, other PR, or a prerequisite action. project: dictionary removal https://github.com/mdn/browser-compat-data/issues/6810 labels Mar 14, 2023
@hamishwillee
Copy link
Contributor Author

@queengooborg PS, on further thought, all this data should be in RTCStatsReport - this is the object used to access the data - which is returned by getStats - make sense?

@queengooborg
Copy link
Contributor

Yes, we should put all the data into RTCStatsReport.

While we're at it, maybe we should structure the data into a tree, with subfeatures for each stats type and subfeatures under those for each property? Example:

{
	"api": {
		"RTCStatsReport": {
			"__compat": { ... },
			"candidate-pair_type": {
				"__compat": {
					"description": "<code>candidate-pair</code> stats type",
					...
				},
				"availableIncomingBitrate": {
					"__compat": { ... }
				}
			}
		}
	}
}

WDYT?

@hamishwillee
Copy link
Contributor Author

@queengooborg

While we're at it, maybe we should structure the data into a tree, with subfeatures for each stats type and subfeatures under those for each property? Example:

Yes :-). I didn't think it mattered originally, but we may well want to link different parts of these subfeatures into different docs. Easier if we split it this way.

@hamishwillee hamishwillee force-pushed the RTCInboundRtpStreamStats branch from a43b09d to d83fa5a Compare March 20, 2023 03:56
@hamishwillee hamishwillee changed the title RTCInboundRtpStreamStats.trackIdentifier + the whole dictionary RTCStatsReport - add stats-type features and stats Mar 20, 2023
@hamishwillee
Copy link
Contributor Author

@queengooborg Done - now all in RTCStatsReport and renamed. I dropped the old commits from the history.

@queengooborg
Copy link
Contributor

I dropped the old commits from the history.

Oh no need to worry about dropping commits and such! BCD strictly squash merges all PRs so they're all compressed into one anyways!

@hamishwillee
Copy link
Contributor Author

Thanks for merging those @queengooborg . I wish we could just merge this - we'd be no worse off in any way, and significantly better for end users.

I am assuming that this is basically on hold while you try make better tests and until decisions on ranged values is made.

@jan-ivar
Copy link
Contributor

I see this duplicates some fields which I suppose is to be expected based on mdn/mdn#384 (comment)?

@schalkneethling
Copy link

I see this duplicates some fields which I suppose is to be expected based on mdn/mdn#384 (comment)?

Thanks so much for jumping in here @jan-ivar - @queengooborg, Jan-Ivar is the person I mentioned yesterday (WebRTC Media Senior Staff Software Engineer).

@hamishwillee
Copy link
Contributor Author

I see this duplicates some fields which I suppose is to be expected based on mdn/mdn#384 (comment)?

@jan-ivar Yes. They are duplicated as sub features of the different selectors, and that is both desirable and expected. I added a response to your response in the linked topic.

@queengooborg
Copy link
Contributor

Thank you @jan-ivar for joining in!

As mentioned in the issue on mdn/mdn, our biggest issue is working out what browser versions each type and property was introduced. While http://wpt.live/webrtc/RTCPeerConnection-mandatory-getStats.https.html is helpful, it doesn't work on all browser versions, nor does it cover all of the properties.

I've attempted to reverse engineer the code for use in our own tooling (see openwebdocs/mdn-bcd-collector@fcd51bc), but I'm running into some issues with it, namely:

  • I don't know what triggers remote-inbound-rtp and remote-outbound-rtp stats. In the WPT.live test, there's just a 20 second maximum delay, but adding that into our own code doesn't seem to trigger the stats types.
    • I haven't been able to trigger remote-outbound-rtp stats.
    • Related properties to those stats don't seem to be working either.

api/RTCStatsReport.json Outdated Show resolved Hide resolved
api/RTCStatsReport.json Outdated Show resolved Hide resolved
api/RTCStatsReport.json Outdated Show resolved Hide resolved
api/RTCStatsReport.json Outdated Show resolved Hide resolved
api/RTCStatsReport.json Outdated Show resolved Hide resolved
@hamishwillee hamishwillee force-pushed the RTCInboundRtpStreamStats branch from 3e2ccc0 to e1cfe16 Compare April 28, 2023 04:50
@hamishwillee hamishwillee force-pushed the RTCInboundRtpStreamStats branch from e1cfe16 to 38e2b49 Compare April 28, 2023 04:52
@hamishwillee
Copy link
Contributor Author

@queengooborg YEEE HAAARRR. All done. Ready for you to look at.

Last pass was to get a few cases which had "true" against them. Just FYI:

  • api.RTCStatsReport.type_data-channel - FF - changed to earliest version of contained subfeatures
  • api.RTCStatsReport.type_inbound-rtp.audioLevel - safari - bsection testing indictates "version_added": "14.1", removed 16.3
  • api.RTCStatsReport.type_remote-inbound-rtp.roundTripTime - FF - v96 by bisection.
  • api.RTCStatsReport.type_remote-outbound-rtp - - safari - used earliest of subfeatures = 11
  • api.RTCStatsReport.type_remote-outbound-rtp.roundTripTime -

Copy link
Contributor

@queengooborg queengooborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all your hard work on this, @hamishwillee! Let's go ahead and get this landed right away!

@queengooborg queengooborg merged commit 40c3c7b into mdn:main Apr 28, 2023
@queengooborg queengooborg removed the not ready This is not yet ready to be merged. It's pending a decision, other PR, or a prerequisite action. label Apr 28, 2023
@hamishwillee hamishwillee deleted the RTCInboundRtpStreamStats branch April 30, 2023 23:31
@hamishwillee
Copy link
Contributor Author

@queengooborg YOU TOO!!!! This is such a good step.

FYI, once I have the docs I'll come back and link to the MDN pages.

@hamishwillee hamishwillee mentioned this pull request May 1, 2023
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API project: dictionary removal https://github.com/mdn/browser-compat-data/issues/6810
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge RTC*Stats to RTCStatsReport
4 participants