Regarding webrtc-stats monitored object ID

Hello,

I'm starting the implementation of the webrtc-stats spec in pion 
(https://github.com/pion/webrtc), a pure go webrtc library. We are 
discussing what's the best approach to follow in regards to the ids of 
the monitored objects. You can read the full discussion (or review the 
implementation) in https://github.com/pion/webrtc/pull/721 but I'll put 
all the information here.

The spec is pretty clear regarding the id, quoting:

> A unique id that is associated with the object that was inspected to 
> produce this RTCStats object. Two RTCStats objects, extracted from two 
> different RTCStatsReport objects, MUST have the same id if they were 
> produced by inspecting the same underlying object. User agents are free 
> to pick any format for the id as long as it meets the requirements 
> above.

So I think is fair to say:

a) every monitored object has an ID
b) the stats for a given object are referenced by such ID

We understand the spec doesn't indicate the monitored object ID should 
be available in the monitored object itself, and we are a bit worried 
about adding it for some general push back against the idea of adding 
ids to webrtc objects 
https://www.w3.org/2018/04/12-webrtc-minutes#item06, however, at the 
same time, we can see how exposing such ids will be a quite convenient 
way of accessing stats, for example:

report := conn.GetStats()
// get connection stats
report[conn.ObjectID()]
// get DC stats
report[dc.ObjectID()]

We are wondering if you have any thoughts or suggestions as how to 
resolve this situation, or if perhaps we are missing the point and 
that's not the intended usage of the API.

Thanks,
Regards,
Hugo Arregui

Received on Tuesday, 25 June 2019 08:01:37 UTC