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

Re: [webrtc-stats] Is keeping stats around a memory problem?

From: Harald Alvestrand via GitHub <sysbot+gh@w3.org>
Date: Wed, 17 Jan 2018 14:13:18 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-358316276-1516198397-sysbot+gh@w3.org>
Copying my idea from the mailing list:

I've been pondering other options, and came up with one:
<pre>
partial interface RTCPeerConnection {
   attribute EventHandler onstatsobjectended;
}
</pre>
and an event
<pre>
interface RTCStatsEvent : Event {
   readonly attribute RTCStats finalStats;
}
</pre>

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:
<pre>
pc.onstatsobjectended = function(e) {
   pc._completedStats.pushBack(e.finalStats);
}

pc.prototype.getCompletedStats = function() {
   return pc._completedStats;
}
</pre>
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?


-- 
GitHub Notification of comment by alvestrand
Please view or discuss this issue at https://github.com/w3c/webrtc-stats/issues/235#issuecomment-358316276 using your GitHub account
Received on Wednesday, 17 January 2018 14:13:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:21:58 UTC