8.5 The stats selection algorithm

The stats selection algorithm is as follows:

  1. Let result be an empty RTCStatsReport.
  2. If selector is null, gather stats for the whole connection, add them to result, return result, and abort these steps.
  3. If selector is an RTCRtpSender, gather stats for and add the following objects to result:
  4. If selector is an RTCRtpReceiver, gather stats for and add the following objects to result:
  5. Return result.