- From: Harald Alvestrand <harald@alvestrand.no>
- Date: Wed, 17 Jan 2018 11:07:31 +0100
- To: "public-webrtc@w3.org" <public-webrtc@w3.org>
In the last WebRTC VI (slides at https://www.w3.org/2011/04/webrtc/wiki/images/6/68/WebRTCWG-2018-01-11.pdf), Jan-Ivar presented a proposal for handling stats for deleted/removed objects that looked like this: partial interface RTCPeerConnection { RTCStatsReport getCompletedStats(optional MediaStreamTrack? selector = null); }; I've been pondering other options, and came up with one: partial interface RTCPeerConnection { attribute EventHandler onstatsobjectended; } and an event interface RTCStatsEvent : Event { readonly attribute RTCStats finalStats; } The advantage of this is that as long as there's no listener attached, this produces no overhead that grows over time; when there's a listener attached, the memory and time overhead is the caller's problem. It's trivial to shim getCompletedStats on top of this: pc.onstatsobjectended = function(e) { pc._completedStats.pushBack(e.finalStats); } pc.prototype.getCompletedStats = function() { return pc._completedStats; } The same thing can be added to RTPSender and RTPReceiver, of course. Thoughts? Is this simpler than getCompletedStats? Are there huge disadvantages to this approach? Harald
Received on Wednesday, 17 January 2018 10:07:56 UTC