Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Edge] pc.getStats(): no way to get usable and needed stats #523

Closed
ibc opened this issue Jun 27, 2017 · 5 comments
Closed

[Edge] pc.getStats(): no way to get usable and needed stats #523

ibc opened this issue Jun 27, 2017 · 5 comments

Comments

@ibc
Copy link
Contributor

ibc commented Jun 27, 2017

getStats() has been added to the Edge's RTCPeerConnection shim. Basically it's achieved by collecting all the stats from the all RTCIceTransport , RTCRtpSender and RTCRtpReceiver instances internally handled by the RTCPeerConnection object.

Below the results of pc.getStats() in Edge after 1 minute (more or less) in a call with a Chrome browser (which was running in a computer with a hardcoded 25% of up/down packet lost):

{  
  "20291937208485":{  
    "id":"20291937208485",
    "type":"transport",
    "timestamp":1498649044000,
    "bytesSent":0,
    "bytesReceived":0,
    "rtcpTransportStatsId":"",
    "activeConnection":true,
    "selectedCandidatePairId":"",
    "localCertificateId":"",
    "remoteCertificateId":""
  },
  "20291937208487":{  
    "id":"20291937208487",
    "timestamp":1498649044000,
    "localAddress":"2.136.213.170:56004",
    "localSite":"192.168.1.41:56004",
    "remoteAddress":"52.90.94.230:10000",
    "remoteSite":"52.90.94.230:4443",
    "iceWarningFlags":{  
      "turnTcpTimedOut":false,
      "turnUdpAllocateFailed":false,
      "turnUdpSendFailed":false,
      "turnTcpAllocateFailed":false,
      "turnTcpSendFailed":false,
      "udpLocalConnectivityFailed":false,
      "udpNatConnectivityFailed":false,
      "udpRelayConnectivityFailed":false,
      "tcpNatConnectivityFailed":false,
      "tcpRelayConnectivityFailed":false,
      "connCheckMessageIntegrityFailed":false,
      "allocationMessageIntegrityFailed":false,
      "connCheckOtherError":false,
      "turnAuthUnknownUsernameError":false,
      "noRelayServersConfigured":true,
      "multipleRelayServersAttempted":false,
      "portRangeExhausted":false,
      "alternateServerReceived":false,
      "pseudoTLSFailure":false,
      "turnTurnTcpConnectivityFailed":false,
      "useCandidateChecksFailed":false,
      "fipsAllocationFailure":false
    },
    "portRangeMin":50001,
    "portRangeMax":65535,
    "localMRTCPPort":0,
    "remoteMRTCPPort":0,
    "stunVer":2,
    "numConsentReqSent":20,
    "numConsentReqReceived":33,
    "numConsentRespSent":33,
    "numConsentRespReceived":20,
    "interfaces":{  
      "interfaceTypeEthernet":false,
      "interfaceTypeWireless":true,
      "interfaceTypePPP":false,
      "interfaceTypeTunnel":true,
      "interfaceTypeWWAN":false
    },
    "protocol":"udp",
    "localInterface":{  
      "interfaceTypeEthernet":false,
      "interfaceTypeWireless":true,
      "interfaceTypePPP":false,
      "interfaceTypeTunnel":false,
      "interfaceTypeWWAN":false
    },
    "localAddrType":"peer-derived",
    "remoteAddrType":"stun",
    "iceRole":"controlled",
    "rtpRtcpMux":true,
    "allocationTimeInMs":23,
    "msRtcEngineVersion":"6.0.8974.294",
    "msType":"transportdiagnostics"
  },
  "20291937196004":{  
    "id":"20291937196004",
    "type":"track",
    "timestamp":1498649044000,
    "trackIdentifier":"EB29FBAC-0E26-4E32-B3BE-2C04E849043C",
    "remoteSource":false,
    "ssrcIds":[  
      "701605465"
    ],
    "frameWidth":0,
    "frameHeight":0,
    "framesPerSecond":0,
    "framesSent":0,
    "framesReceived":0,
    "framesDecoded":0,
    "framesDropped":0,
    "framesCorrupted":0,
    "audioLevel":-31,
    "echoReturnLoss":0,
    "echoReturnLossEnhancement":0
  },
  "20291937196001":{  
    "id":"20291937196001",
    "type":"inboundrtp",
    "timestamp":1498649044000,
    "ssrc":"0",
    "isRemote":true,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20291937196002",
    "mediaTrackId":"20291937196004",
    "transportId":"20291937208485",
    "packetsReceived":0,
    "bytesReceived":0,
    "packetsLost":0,
    "jitter":0,
    "fractionLost":0
  },
  "20291937196002":{  
    "id":"20291937196002",
    "type":"outboundrtp",
    "timestamp":1498649044000,
    "ssrc":"701605465",
    "isRemote":false,
    "codecId":"opus",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20291937196001",
    "mediaTrackId":"20291937196004",
    "transportId":"20291937208485",
    "packetsSent":0,
    "bytesSent":0,
    "targetBitrate":0,
    "roundTripTime":0
  },
  "20291937252164":{  
    "id":"20291937252164",
    "type":"track",
    "timestamp":1498649044000,
    "trackIdentifier":"8F275253-8565-4BD7-BA3E-49DF1AE05E4D",
    "remoteSource":false,
    "ssrcIds":[  
      "2256665303"
    ],
    "frameWidth":0,
    "frameHeight":0,
    "framesPerSecond":0,
    "framesSent":0,
    "framesReceived":0,
    "framesDecoded":0,
    "framesDropped":0,
    "framesCorrupted":0,
    "audioLevel":0,
    "echoReturnLoss":0,
    "echoReturnLossEnhancement":0
  },
  "20291937252161":{  
    "id":"20291937252161",
    "type":"inboundrtp",
    "timestamp":1498649044000,
    "ssrc":"0",
    "isRemote":true,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20291937252162",
    "mediaTrackId":"20291937252164",
    "transportId":"20291937208485",
    "packetsReceived":0,
    "bytesReceived":0,
    "packetsLost":0,
    "jitter":0,
    "fractionLost":0
  },
  "20291937252162":{  
    "id":"20291937252162",
    "type":"outboundrtp",
    "timestamp":1498649044000,
    "ssrc":"2256665303",
    "isRemote":false,
    "codecId":"VP8",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20291937252161",
    "mediaTrackId":"20291937252164",
    "transportId":"20291937208485",
    "packetsSent":1556,
    "bytesSent":0,
    "targetBitrate":0,
    "roundTripTime":0
  },
  "20287305816964":{  
    "id":"20287305816964",
    "type":"track",
    "timestamp":1498649044000,
    "trackIdentifier":"FC920022-04C7-4E11-9BAC-BAC3C9CD1968",
    "remoteSource":true,
    "ssrcIds":[  
      "1709210239"
    ],
    "frameWidth":0,
    "frameHeight":0,
    "framesPerSecond":0,
    "framesSent":0,
    "framesReceived":0,
    "framesDecoded":0,
    "framesDropped":0,
    "framesCorrupted":0,
    "audioLevel":0,
    "echoReturnLoss":0,
    "echoReturnLossEnhancement":0
  },
  "20287305816961":{  
    "id":"20287305816961",
    "type":"inboundrtp",
    "timestamp":1498649044000,
    "ssrc":"1709210239",
    "isRemote":false,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20287305816962",
    "mediaTrackId":"20287305816964",
    "transportId":"20291937208485",
    "packetsReceived":0,
    "bytesReceived":0,
    "packetsLost":0,
    "jitter":0,
    "fractionLost":0
  },
  "20287305816962":{  
    "id":"20287305816962",
    "type":"outboundrtp",
    "timestamp":1498649044000,
    "ssrc":"0",
    "isRemote":true,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20287305816961",
    "mediaTrackId":"20287305816964",
    "transportId":"20291937208485",
    "packetsSent":0,
    "bytesSent":0,
    "targetBitrate":0,
    "roundTripTime":0
  },
  "20292021592324":{  
    "id":"20292021592324",
    "type":"track",
    "timestamp":1498649044000,
    "trackIdentifier":"CF10D197-BCB7-4BB1-8E9D-988183074310",
    "remoteSource":true,
    "ssrcIds":[  
      "2409668377"
    ],
    "frameWidth":0,
    "frameHeight":0,
    "framesPerSecond":0,
    "framesSent":0,
    "framesReceived":0,
    "framesDecoded":0,
    "framesDropped":0,
    "framesCorrupted":0,
    "audioLevel":-32,
    "echoReturnLoss":0,
    "echoReturnLossEnhancement":0
  },
  "20292021592321":{  
    "id":"20292021592321",
    "type":"inboundrtp",
    "timestamp":1498649044000,
    "ssrc":"2409668377",
    "isRemote":false,
    "codecId":"opus",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20292021592322",
    "mediaTrackId":"20292021592324",
    "transportId":"20291937208485",
    "packetsReceived":4466,
    "bytesReceived":0,
    "packetsLost":0,
    "jitter":0.006,
    "fractionLost":0.10599517822265625
  },
  "20292021592322":{  
    "id":"20292021592322",
    "type":"outboundrtp",
    "timestamp":1498649044000,
    "ssrc":"0",
    "isRemote":true,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20292021592321",
    "mediaTrackId":"20292021592324",
    "transportId":"20291937208485",
    "packetsSent":0,
    "bytesSent":0,
    "targetBitrate":0,
    "roundTripTime":0
  },
  "20292021601924":{  
    "id":"20292021601924",
    "type":"track",
    "timestamp":1498649044000,
    "trackIdentifier":"46AB3E5E-13D0-4C88-8E50-E3DDF72660B4",
    "remoteSource":true,
    "ssrcIds":[  
      "799301531"
    ],
    "frameWidth":640,
    "frameHeight":360,
    "framesPerSecond":18.35708236694336,
    "framesSent":0,
    "framesReceived":0,
    "framesDecoded":0,
    "framesDropped":0,
    "framesCorrupted":0,
    "audioLevel":0,
    "echoReturnLoss":0,
    "echoReturnLossEnhancement":0
  },
  "20292021601921":{  
    "id":"20292021601921",
    "type":"inboundrtp",
    "timestamp":1498649044000,
    "ssrc":"799301531",
    "isRemote":false,
    "codecId":"VP8",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20292021601922",
    "mediaTrackId":"20292021601924",
    "transportId":"20291937208485",
    "packetsReceived":5832,
    "bytesReceived":0,
    "packetsLost":0,
    "jitter":0.002,
    "fractionLost":0.030874136835336685
  },
  "20292021601922":{  
    "id":"20292021601922",
    "type":"outboundrtp",
    "timestamp":1498649044000,
    "ssrc":"0",
    "isRemote":true,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20292021601921",
    "mediaTrackId":"20292021601924",
    "transportId":"20291937208485",
    "packetsSent":0,
    "bytesSent":0,
    "targetBitrate":0,
    "roundTripTime":0
  },
  "20287247411844":{  
    "id":"20287247411844",
    "type":"track",
    "timestamp":1498649044000,
    "trackIdentifier":"980E7C4B-F7F3-4517-9347-EF97786DDD89",
    "remoteSource":true,
    "ssrcIds":[  
      "4265767963"
    ],
    "frameWidth":0,
    "frameHeight":0,
    "framesPerSecond":0,
    "framesSent":0,
    "framesReceived":0,
    "framesDecoded":0,
    "framesDropped":0,
    "framesCorrupted":0,
    "audioLevel":0,
    "echoReturnLoss":0,
    "echoReturnLossEnhancement":0
  },
  "20287247411841":{  
    "id":"20287247411841",
    "type":"inboundrtp",
    "timestamp":1498649044000,
    "ssrc":"4265767963",
    "isRemote":false,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20287247411842",
    "mediaTrackId":"20287247411844",
    "transportId":"20291937208485",
    "packetsReceived":0,
    "bytesReceived":0,
    "packetsLost":0,
    "jitter":0,
    "fractionLost":0
  },
  "20287247411842":{  
    "id":"20287247411842",
    "type":"outboundrtp",
    "timestamp":1498649044000,
    "ssrc":"0",
    "isRemote":true,
    "codecId":"",
    "firCount":0,
    "pliCount":0,
    "nackCount":0,
    "sliCount":0,
    "associateStatsId":"20287247411841",
    "mediaTrackId":"20287247411844",
    "transportId":"20291937208485",
    "packetsSent":0,
    "bytesSent":0,
    "targetBitrate":0,
    "roundTripTime":0
  }
}
@ibc
Copy link
Contributor Author

ibc commented Jun 28, 2017

The bad news is that collected stats are not accurate and they do not expose real values. For example:

  • pliCount and nackCount are always 0.
  • In a type="inboundrtp" stat, packetsReceived may be greater than 0, but bytesReceived is always 0.
  • In a type="outboundrtp" stat, packetsSent may be greater than 0, but bytesSent is always 0. And roundTripTime is always 0.
  • Most of the other values are always 0.
  • etc, etc

I don't think this is usable at all.

@saghul
Copy link
Member

saghul commented Jun 28, 2017

We need these things AFAIS:

  • audio levels
  • resolution
  • framerate
  • bitrate

If we can't get some of them, that's ok, lets hope they are added eventually to Edge.

@ibc
Copy link
Contributor Author

ibc commented Jun 28, 2017

More problems:

  • audioLevel in modern W3C RTCStats is in the range 0..1. In Edge it's given in dBov (0 means 0db == maximum level, -100 means -100dB == no audio). However, in the legacy RTCStats of Chrome we get 0 (minimum) and XXXXX (maximum).
  • Edge does not set frameWidth/frameHeight/framesPerSecond in type="track" stats for local video tracks, so by checking the stats there is no way to get the resolution of the local video, nor its frame rate.
  • Edge does not add availableOutgoingBitrate/availableIncomingBitrate or similar, nor sending bitrate.

@ibc
Copy link
Contributor Author

ibc commented Jun 28, 2017

Replying to @saghul's comment after checking everything:

We need these things AFAIS:

audio levels

audioLevel in modern W3C RTCStats is in the range 0..1. In Edge it's given in dBov (0 means maximum level, -127 means no audio). However, in the legacy RTCStats of Chrome we have 0 (minimum) and XXXXX (maximum).

resolution

Unfeasible. Edge does not set frameWidth/frameHeight in type="track" for local tracks.

framerate

Unfeasible. Edge does not set framesPerSecond in type="track" for local tracks.

bitrate

Unfeasible. Edge does not add availableOutgoingBitrate/availableIncomingBitrate or similar, nor sending bitrate.

@ibc ibc changed the title [Edge] Implement getStats() [Edge] pc.getStats(): no way to get usable and needed stats Jun 28, 2017
@saghul
Copy link
Member

saghul commented Jun 30, 2017

Fixed in 6437dfa

@saghul saghul closed this as completed Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants