title: Access RTCMediaStreamTrack statistics, injection causing issues
body: <p>I'm currently working on a userscript to provide additional features to the Google Stadia platform. One of the implemented features is a stream monitor to display frame loss among other <a href="https://i.imgur.com/dxJyvPQ.png" rel="nofollow noreferrer">statistics</a> provided by the WebRTC stream. However, we are running into issues when injecting code into the existing function to get said statistics in the first place.</p>
  <p>For some reason even just injecting the code;</p>
  <pre><code>// ==UserScript==
  // @name        Stadia Test
  // @version     0.1
  // @author      ChristopherKlay
  // @match       https://stadia.google.com/*home
  // @grant       none
  // ==/UserScript==
  
  var peerConnections = [];
    
  (function(original) {
      RTCPeerConnection = function() {
          var connection = new original(arguments);
          peerConnections.push(connection);
          return connection;
      };
      RTCPeerConnection.prototype = original.prototype;
  })(RTCPeerConnection);
  </code></pre>
  <p>creates an issue that blocks the user from connecting to the voice chat. The stats of the stream get loaded and everything else including the actual game stream is working perfectly fine, without any errors being thrown in the console. The only issue is that the user can join a party, but connecting to the voice chat results in a short delay before seeing the &quot;Connect&quot; option again, without any errors.</p>
  <p>I've already checked the rest of the <a href="https://pastebin.com/raw/iiAFNV3F" rel="nofollow noreferrer">full script</a> and the problem is definitely the injection. You replicate the same bug by only using the code above in a userscript; voice chat in a party already can't connect anymore.</p>
  <p>I'm sadly not aware of an easier way to access these statistics (the only info needed out of this), so any help would be appreciated.</p>