[Webkit-unassigned] [Bug 192601] New: RTCPeerConnection#getStats returns RTCStatsReport which is very different from the spec.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 11 12:34:09 PST 2018


https://bugs.webkit.org/show_bug.cgi?id=192601

            Bug ID: 192601
           Summary: RTCPeerConnection#getStats returns RTCStatsReport
                    which is very different from the spec.
           Product: WebKit
           Version: Safari 12
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: syerrapragada at twilio.com
                CC: youennf at gmail.com

Spec: https://www.w3.org/TR/webrtc-stats/

RTCPeerConnection#getStats is not according to the spec above.

  1. RTCPeerConnection#getStats does not honor selector argument
  2. Cannot correlate remote tracks in stats report.
  3. StatsReport does not have local-candidate stats type.
  4. StatsReport does not have remote-candidate stats type.
  5. StatsReport does not have codec stats type.

This following fiddle should help reproduce the issues mentioned above.
https://jsfiddle.net/o6fc03uw/1/

Code in fiddle:
(async () => {
      const pc1 = new RTCPeerConnection()
      const pc2 = new RTCPeerConnection()

      const stream1 = await navigator.mediaDevices.getUserMedia({ audio: true })
      const stream2 = await navigator.mediaDevices.getUserMedia({ audio: true })
      const [track1] = stream1.getAudioTracks()
      const [track2] = stream2.getAudioTracks()

      pc2.addTrack(track1, stream1)
      pc2.addTrack(track2, stream2)

      pc1.addTransceiver('audio')
      pc1.addTransceiver('audio')

      const offer = await pc1.createOffer()
      await Promise.all([
        pc1.setLocalDescription(offer),
        pc2.setRemoteDescription(offer)
      ])

      const answer = await pc2.createAnswer()
      await Promise.all([
        pc1.setRemoteDescription(answer),
        pc2.setLocalDescription(answer)
      ])

      const recvrs = pc1.getReceivers()
      const statsReport = await pc1.getStats(recvrs[0].track)
        const tracksInReport = Array.from(statsReport.values()).filter(stat => stat.type === 'track');

      if (tracksInReport.length > 1) {
        console.warn('More than 1 track in stats report.' +
                'RTCPeerConnection#getStats does not honor selector argument.');
        var remoteTrackStats = tracksInReport.find(
                stat => stat.trackIdentifier === recvrs[0].track.id)

        if (!remoteTrackStats) {
                console.warn('Cannot correlate remote tracks in stats report.');
        }
      }

      var localCandidateStats = Array.from(statsReport.values()).find(
        stat => stat.type === 'local-candidate');
      if (!localCandidateStats) {
        console.warn('StatsReport does not have local-Candidate stats type.');
      }

      var remoteCandidateStats = Array.from(statsReport.values()).find(
        stat => stat.type === 'remote-candidate');
      if (!remoteCandidateStats) {
        console.warn('StatsReport does not have remote-candidate stats type.');
      }

      var codecStats = Array.from(statsReport.values()).find(
        stat => stat.type === 'codec');
      if (!codecStats) {
        console.warn('StatsReport does not have codec stats type.');
      }

    })()

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181211/2768c50d/attachment.html>


More information about the webkit-unassigned mailing list