w3c / webrtc-stats

WebRTC Statistics
https://w3c.github.io/webrtc-stats/
Other
128 stars 47 forks source link

Unclear result of stats filtering by sender/receiver. #571

Open murillo128 opened 4 years ago

murillo128 commented 4 years ago

When filtering by sender or receiver, the stats selection algorithm is as follows:

- If selector is an RTCRtpSender, gather stats for and add the following objects to result:
  * All RTCOutboundRTPStreamStats objects representing RTP streams being sent by selector.
  * All stats objects referenced directly or indirectly by the RTCOutboundRTPStreamStats objects added.
- If selector is an RTCRtpReceiver, gather stats for and add the following objects to result: 
  * All RTCInboundRTPStreamStats objects representing RTP streams being received by selector.
  * All stats objects referenced directly or indirectly by the RTCInboundRTPStreamStats added.

but in no place it is defined which are the stats objects referenced directly or indirectly.

I understand that the intention was to leave it open so the webrtc stats define those stats, but currently it is defined nowhere which would lead to not deterministic implementation on browsers.

jan-ivar commented 4 years ago

The language is a catch-all to ensure all referenced stats objects are included, so we don't have to update this in two specs.

We could probably update "referenced" to "referenced", except that section is non-normative for some reason.

murillo128 commented 4 years ago

I think we should move the filtering algorithm to the stats doc, that way we can explicitly specify which stats are returned and avoid updating two specs.

jan-ivar commented 4 years ago

A problem with an explicit list in webrtc-stats is that not all of webrtc-stats is Mandatory to Implement in WebRTC 1.0. So the total list will vary based on which stats above that baseline are implemented. A rule seems more flexible than a list here (for every stat above that baseline, be sure to include everything it references).

The invariant sought is for every xxxId key encountered, stats.get(stat.xxxId) must succeed.

That seems like a referential integrity test we could do from webrtc-pc even without domain knowledge of individual stats.

murillo128 commented 4 years ago

Form a developer point of view it is unfortunate to have a different set of stats in each browser, but it is what it is.

Having a rule at least would allow know what to look for, i think that the referenced stat id would work