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

mangle getStats #124

Closed
wants to merge 28 commits into from
Closed

mangle getStats #124

wants to merge 28 commits into from

Conversation

fippo
Copy link
Member

@fippo fippo commented Aug 15, 2015

Not sure how far i'll get before giving up or if the end result will still be merge-able but I found a number of spec and implementation bugs within minutes so this seems worthwhile.

note that the approach might break if applications expect to find a report of type googCandidatePair -- hopefully applications where the stats get mangled don't do this.

@alvestrand

standardStats.priority = 'FIXME'; // unsigned long long
standardStats.nominated = 'FIXME'; // boolean
// FIXME: missing from spec
standardStats.selected =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Selected" is tricky. "Nominated" is well defined in the spec.
There is a selectedCandidatePairId as part of the RTCTransportStats.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selected seems well defined in https://tools.ietf.org/html/rfc5245#section-2.6 too?

I am assuming that the selectedCandidatePairId points to the candidatePair with selected === true. But that means having a selected attribute here does not add much value.

@fippo
Copy link
Member Author

fippo commented Aug 27, 2015

the more I am thinking about this (and writing code) the trickier this seems to get. Biggest issue is that there is no 1:1 mapping between the current chrome stats and the spec stats so some reports need to be split into two?

@jan-ivar
Copy link
Collaborator

I think of the whole snowball as one "report". Do you mean split up some of the dictionaries?

@fippo
Copy link
Member Author

fippo commented Aug 27, 2015

@jan-ivar yes. The chrome type ssrc seems to contain both sender and receiver statistics which (IIUC) in the new model are in separate things. E.g. you have an inboundrtp report which has a remoteId that gives you the thing where you can query packet loss.

@jan-ivar
Copy link
Collaborator

jan-ivar commented Sep 2, 2015

Yes, I try to explain that squirrelly case here if it helps. Though, when you "query" it's really nothing more than an object property lookup between two dictionaries in the same object. Should be possible to reconstitute.

@fippo
Copy link
Member Author

fippo commented Sep 9, 2015

just noticed that I never pushed https://github.com/fippo/adapter/commit/888d1cc7b0a8869783d8be84c2968afe0bf7b43f
-- which was the thing really confusing me because the ssrc reports seemed merge both rtp and rtcp reports so I would need to split up things.

@fippo
Copy link
Member Author

fippo commented Sep 29, 2015

@alvestrand did you ever see https://codereview.webrtc.org/1307633007/ ? Not sure if it really helps since I might end up having to shim this by iterating over all local and remote tracks anyway until the potential change lands in all chrome versions

@fippo
Copy link
Member Author

fippo commented Oct 19, 2015

@alvestrand I think this is ready for a detailed review. The output comes pretty close to what I think it should be.

It seems to me that adding a RTCCodec dictionary to the native lib should be relatively straightforward. And it would avoid sdp 'parsing', I can take a look at that.

@fippo
Copy link
Member Author

fippo commented Oct 20, 2015

(when you say you're done and you notice you forgot to split up local and remote measurements...)
Easiest way to check this is to put it into a local samples copy and run the constraints demo.

@fippo
Copy link
Member Author

fippo commented Oct 22, 2015

Fixed some more bugs and (experimentally) removed any goog* and ssrc reports. Also removed any attributes with goog* prefix (which discards some things I am interested in so this is too aggressive).
Got the following JSON dump for an audio-only connection:

{
 "googCertificate_70:7F:5B:E8:D8:3D:76:A5:69:7C:BC:C9:A5:75:50:2A:CC:29:7B:ED:5D:77:31:2D:C1:B5:6A:8A:41:1C:EE:B3": {
  "id": "googCertificate_70:7F:5B:E8:D8:3D:76:A5:69:7C:BC:C9:A5:75:50:2A:CC:29:7B:ED:5D:77:31:2D:C1:B5:6A:8A:41:1C:EE:B3",
  "timestamp": 1445532159629,
  "type": "certificate",
  "fingerprint": "70:7F:5B:E8:D8:3D:76:A5:69:7C:BC:C9:A5:75:50:2A:CC:29:7B:ED:5D:77:31:2D:C1:B5:6A:8A:41:1C:EE:B3",
  "fingerprintAlgorithm": "sha-256",
  "base64Certificate": "MIIBmTCCAQKgAwIBAgIEbPhGPTANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDEwZXZWJSVEMwHhcNMTUxMDA4MjEwOTI1WhcNMTUxMTA3MjEwOTI1WjARMQ8wDQYDVQQDEwZXZWJSVEMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALlkhhv5MTUyX8E28N81V9agPPJfrY2Z+bTkCcOhKyWhHZE3Ccgb1WHgn7N1NzJXUdFP3I125x7uKFfkwMk3lZBoMxf1rmIbsGu/9zxx8zOtQv2b5LegbibJtQHpnKBQUE57q0vbc1jRYxtuodbqpquCWsKjJ7KL3/TzLW/1D8orAgMBAAEwDQYJKoZIhvcNAQELBQADgYEAGt6Da/lSTPDhdwVlu6df8F0aeC+IdvjUuJ1YWbzoufGhd8s1qtYHTzZOMf4airBxWZxt1h/XRRtw2HJXkY7j1MEflLjyCG2mxzkq6IHFRjU8fZL+i8wlJM4mcgDsKNBVzO8sc+UW5tIk7YMq7WeNoYEj5joBf/k3B86Mi7Aq9ns=",
  "issuerCertificateId": null
 },
 "Conn-audio-1-0": {
  "id": "Conn-audio-1-0",
  "timestamp": 1445532159629,
  "type": "candidatepair",
  "bytesReceived": 900,
  "remoteCandidateId": "Cand-hpCARt6e",
  "localCandidateId": "Cand-FnD0SZ6Z",
  "bytesSent": 11372,
  "packetsSent": 102,
  "transportId": "transport_Channel-audio-1",
  "writable": true,
  "readable": true,
  "nominated": true,
  "selected": true,
  "packetsDiscardedOnSend": 0,
  "roundTripTime": 1265,
  "availableOutgoingBitrate": 0,
  "availableIncomingBitrate": 0
 },
 "Cand-FnD0SZ6Z": {
  "id": "Cand-FnD0SZ6Z",
  "timestamp": 1445532158030,
  "type": "localcandidate",
  "portNumber": 45359,
  "networkType": "unknown",
  "ipAddress": "10.0.3.1",
  "transport": "udp",
  "candidateType": "host",
  "priority": 2122260223
 },
 "Cand-hpCARt6e": {
  "id": "Cand-hpCARt6e",
  "timestamp": 1445532158030,
  "type": "remotecandidate",
  "portNumber": 52363,
  "ipAddress": "10.0.3.1",
  "transport": "udp",
  "candidateType": "host",
  "priority": 2122260223
 },
 "Conn-audio-1-1": {
  "id": "Conn-audio-1-1",
  "timestamp": 1445532159629,
  "type": "candidatepair",
  "bytesReceived": 0,
  "remoteCandidateId": "Cand-hpCARt6e",
  "localCandidateId": "Cand-Sup3rPk6",
  "bytesSent": 0,
  "packetsSent": 0,
  "transportId": "Channel-audio-1",
  "writable": true,
  "readable": false,
  "nominated": false,
  "selected": false,
  "packetsDiscardedOnSend": 0,
  "roundTripTime": 1265,
  "availableOutgoingBitrate": 0,
  "availableIncomingBitrate": 0
 },
 "Cand-Sup3rPk6": {
  "id": "Cand-Sup3rPk6",
  "timestamp": 1445532158030,
  "type": "localcandidate",
  "portNumber": 48001,
  "networkType": "wlan",
  "ipAddress": "192.168.1.202",
  "transport": "udp",
  "candidateType": "host",
  "priority": 2122194687
 },
 "Conn-audio-1-2": {
  "id": "Conn-audio-1-2",
  "timestamp": 1445532159629,
  "type": "candidatepair",
  "bytesReceived": 0,
  "remoteCandidateId": "Cand-CXKxX2gz",
  "localCandidateId": "Cand-FnD0SZ6Z",
  "bytesSent": 0,
  "packetsSent": 0,
  "transportId": "Channel-audio-1",
  "writable": false,
  "readable": true,
  "nominated": false,
  "selected": false,
  "packetsDiscardedOnSend": 0,
  "roundTripTime": 3000,
  "availableOutgoingBitrate": 0,
  "availableIncomingBitrate": 0
 },
 "Cand-CXKxX2gz": {
  "id": "Cand-CXKxX2gz",
  "timestamp": 1445532158030,
  "type": "remotecandidate",
  "portNumber": 38704,
  "ipAddress": "192.168.1.202",
  "transport": "udp",
  "candidateType": "host",
  "priority": 2122194687
 },
 "transport_Channel-audio-1": {
  "type": "transport",
  "timestamp": 1445532159629,
  "id": "transport_Channel-audio-1",
  "bytesSent": 11372,
  "bytesReceived": 900,
  "activeConnection": true,
  "selectedCandidatePairId": "Conn-audio-1-0",
  "localCertificateId": "googCertificate_70:7F:5B:E8:D8:3D:76:A5:69:7C:BC:C9:A5:75:50:2A:CC:29:7B:ED:5D:77:31:2D:C1:B5:6A:8A:41:1C:EE:B3",
  "remoteCertificateId": "googCertificate_70:7F:5B:E8:D8:3D:76:A5:69:7C:BC:C9:A5:75:50:2A:CC:29:7B:ED:5D:77:31:2D:C1:B5:6A:8A:41:1C:EE:B3"
 },
 "rtpstream_ssrc_2702215055_send": {
  "timestamp": 1445532159629,
  "id": "rtpstream_ssrc_2702215055_send",
  "ssrc": 2702215055,
  "mediaType": "audio",
  "associateStatsId": "rtcpstream_ssrc_2702215055_send",
  "isRemote": false,
  "mediaTrackId": "mediatrack_ssrc_2702215055_send",
  "transportId": "transport_Channel-audio-1",
  "codecId": "codec_opus",
  "type": "outboundrtp",
  "packetsSent": 99,
  "bytesReceived": 9974
 },
 "rtcpstream_ssrc_2702215055_send": {
  "timestamp": 1445532159629,
  "id": "rtcpstream_ssrc_2702215055_send",
  "ssrc": 2702215055,
  "associateStatsId": "rtpstream_ssrc_2702215055_send",
  "isRemote": true,
  "mediaTrackId": "mediatrack_ssrc_2702215055_send",
  "transportId": "transport_Channel-audio-1",
  "codecId": "codec_opus",
  "type": "inboundrtp",
  "packetsLost": -1,
  "jitter": -1
 },
 "mediatrack_ssrc_2702215055_send": {
  "type": "track",
  "timestamp": 1445532159629,
  "id": "mediatrack_ssrc_2702215055_send",
  "trackIdentifier": "4046f224-6d09-4a97-a566-b656aab882ec",
  "remoteSource": false,
  "ssrcIds": [
   "rtpstream_ssrc_2702215055_send",
   "rtcpstream_ssrc_2702215055_send"
  ],
  "audioLevel": 0.02432325205236976,
  "echoReturnLoss": -100,
  "echoReturnLossEnhancement": -100
 },
 "codec_ssrc_2702215055_send": {
  "type": "codec",
  "timestamp": 1445532159629,
  "id": "codec_ssrc_2702215055_send",
  "codec": "opus",
  "payloadType": 111,
  "clockRate": 48000,
  "channels": 2,
  "parameters": ""
 }
}

This looks pretty sane actually.

@KaptenJansson
Copy link
Collaborator

Ping

@fippo
Copy link
Member Author

fippo commented Jan 15, 2016

build failure will be fixed by #161 -- but don't merge this before @alvestrand agrees this is what the stats should look like ,-)

@KaptenJansson
Copy link
Collaborator

ping @alvestrand

@fippo fippo closed this Jul 25, 2016
@fippo fippo deleted the getstats-mangling branch July 25, 2016 21:35
@fippo fippo restored the getstats-mangling branch July 25, 2016 21:36
@fippo fippo reopened this Jul 25, 2016
@KaptenJansson
Copy link
Collaborator

Is this still something we want to do?

});
};

driver.manage().timeouts().setScriptTimeout(3000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a very high level test. I'd like to see some tests just on the fixChromeStats function, where you take a stats object (cut-down version of something that Chrome emits) and check that it turns into a standards-shaped stats object. This also serves as good documentation of how the two APIs look.

@alvestrand
Copy link
Contributor

Yes, we want to do it. But it requires more review - I get confused with what this thing actually transforms.
the google ssrc object contains data that belongs to various standards objects. The split-apart needs to be documented & tested.

@fippo
Copy link
Member Author

fippo commented Dec 5, 2016

i'd rather wait for the new stuff to land :-)

@fippo fippo closed this Dec 5, 2016
@fippo fippo deleted the getstats-mangling branch September 10, 2017 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants