W3C home > Mailing lists > Public > public-webrtc@w3.org > January 2018

Alternatives to GetDeletedStats()

From: Harald Alvestrand <harald@alvestrand.no>
Date: Wed, 17 Jan 2018 11:07:31 +0100
To: "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <ed00ac57-4494-18f3-4562-39910e58455d@alvestrand.no>
In the last WebRTC VI (slides at
Jan-Ivar presented a proposal for handling stats for deleted/removed
objects that looked like this:

partial interface RTCPeerConnection {
  RTCStatsReport getCompletedStats(optional MediaStreamTrack? selector =

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.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?

Received on Wednesday, 17 January 2018 10:07:56 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 17 January 2018 10:07:57 UTC