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

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 : Saturday, 6 May 2023 21:19:43 UTC