DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (b6d82b1a6b02)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    bug: "1452673",
    title: "Trackless RTCRtpSender.getStats()",
    visible: true
  });

  // Calling getstats() on a trackless RTCRtpSender should yield an empty
  // stats report.  When track stats are added in the future, the stats
  // for the removed tracks should continue to appear.

  var test;
  runNetworkTest(function (options) {
    test = new PeerConnectionTest(options);
    test.chain.removeAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW");
    test.chain.append(
      async function PC_LOCAL_AND_REMOTE_TRACKLESS_SENDER_STATS(test) {
        return Promise.all([test.pcLocal.waitForSyncedRtcp(),
                  test.pcRemote.waitForSyncedRtcp()])
          .then(async () => {
            let senders = test.pcLocal.getSenders();
            let receivers = test.pcRemote.getReceivers();
            is(senders.length, 2, "Have exactly two senders.");
            is(receivers.length, 2, "Have exactly two receivers.");
            for(let kind of ["audio", "video"]) {
              is(senders.filter(s => s.track.kind == kind).length, 1,
                  "Exactly 1 sender of kind " + kind);
              is(receivers.filter(r => r.track.kind == kind).length, 1,
                  "Exactly 1 receiver of kind " + kind);
            }
            // Remove tracks from senders
            for (const sender of senders) {
              await sender.replaceTrack(null);
              is(sender.track, null, "Sender track removed");
              let stats = await sender.getStats();
              ok(stats instanceof window.RTCStatsReport, "Stats is instance of RTCStatsReport");
              // Number of stats in the report. This should be 0.
              is(stats.size, 0, "Trackless sender stats report is empty");
            }
          })
        });
    test.setMediaConstraints([{audio: true}, {video: true}], []);
    test.run();
  });

</script>
</pre>
</body>
</html>