Re: Regarding webrtc-stats monitored object ID

[Sorry I realise now that I didn't send my answer to the mailing list]

Hello again,

Thanks for your comments and suggestions!

> and given that this is a fresh API and outside the browser you
> are free to do as you will ;-)
> but I think ObjectID is a bit too broad - perhaps StatsID ?

I thought it might be useful to share the approach we decided to follow:

We added the statsID to every monitored object, but we are keeping it 
private. Taking advantage of the fact that in go objects of the same 
package can access private members of each other, we added a set of 
helper methods to the report object to retrieve the associated stats of 
a given monitored object, for example:

func (r StatsReport) GetConnectionStats(conn *PeerConnection) 
(PeerConnectionStats, bool) {
     statsID := conn.getStatsID()
     stats, ok := r[statsID]
     return pcStats, true

This is a pretty neat API IMO, but unfortunately this is not a portable 
solution, since it relies on the package visibility of the go 
programming language. IMHO exposing the stats id of the monitored 
objects will help to have a cleaner API when you are doing things like 
online analysis (I mean that as oppose of storing stats for offline 
processing later).

Thanks again!

Received on Saturday, 29 June 2019 17:42:10 UTC