Bug 212668 - Missing WebRTC Metrics in iOS Safari
Summary: Missing WebRTC Metrics in iOS Safari
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 13
Hardware: iPhone / iPad iOS 13
: P2 Major
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on: 206645
Blocks:
  Show dependency treegraph
 
Reported: 2020-06-02 16:31 PDT by charob
Modified: 2020-08-24 12:43 PDT (History)
13 users (show)

See Also:


Attachments
Patch (6.44 KB, patch)
2020-06-08 06:58 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description charob 2020-06-02 16:31:18 PDT
WebRTC getStats API is missing critical metric values in iOS Safari
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/getStats

Comparing WebRTC metrics from Chrome and iOS Safari there are many missing metrics that are not available in Safari.

There is a sample that prints all stats for example available here: https://webrtc.github.io/samples/src/content/peerconnection/constraints/


For the video "inbound-rtp" type with id RTCInboundRTPVideoStream_..., it is missing the following critical metrics: 

"kind"
"keyFramesDecoded"
"totalDecodeTime"
"totalInterFrameDelay"
"totalSquaredInterFrameDelay"

Also missing but not as critical to have:

"lastPacketReceivedTimestamp"
"headerBytesReceived"
"decoderImplementation"
"estimatedPlayoutTimestamp"


For the audio "inbound-rtp" type with id RTCInboundRTPAudioStream_..., it is missing the following critical metrics: 

"kind"

Also missing but not as critical to have:

"estimatedPlayoutTimestamp"
"fecPacketsDiscarded"
"fecPacketsReceived"
"headerBytesReceived"
"lastPacketReceivedTimestamp"

For the audio "track" type with id RTCMediaStreamTrack_..., it is missing the following critical metrics: 

"kind"
"jitterBufferDelay"
"jitterBufferEmittedCount"

Also missing but not as critical to have:

"concealedSamples"
"concealmentEvents"
"insertedSamplesForDeceleration"
"removedSamplesForAcceleration"
"silentConcealedSamples"
"totalAudioEnergy"
"totalSamplesDuration"
"totalSamplesReceived"

For the video "track" type with id RTCMediaStreamTrack_..., it is missing the following critical metrics: 

"kind"
"jitterBufferDelay"
"jitterBufferEmittedCount"

For the transport type with id RTCTransport_0_1, it is missing the following metrics:

"dtlsCipher"
"dtlsState"
"selectedCandidatePairChanges"
"srtpCipher"
"tlsVersion"

Below is an example of metrics returned from Chrome:

[
    {
      "bytesReceived": 54184,
      "bytesSent": 14599,
      "datachannelid": 1,
      "id": "RTCDataChannel_1",
      "label": "messageChannel",
      "messagesReceived": 22,
      "messagesSent": 888,
      "protocol": "",
      "state": "open",
      "timestamp": 1589957352309.487,
      "type": "data-channel"
    },
    {
      "availableOutgoingBitrate": 300000,
      "bytesReceived": 1652430303,
      "bytesSent": 2128818,
      "consentRequestsSent": 321,
      "currentRoundTripTime": 0.035,
      "id": "RTCIceCandidatePair_pNUroWhv_ZdfFPSAc",
      "localCandidateId": "RTCIceCandidate_pNUroWhv",
      "nominated": true,
      "priority": 7926369428982087000,
      "remoteCandidateId": "RTCIceCandidate_ZdfFPSAc",
      "requestsReceived": 309,
      "requestsSent": 1,
      "responsesReceived": 311,
      "responsesSent": 309,
      "state": "succeeded",
      "timestamp": 1589957352309.487,
      "totalRoundTripTime": 30.956,
      "transportId": "RTCTransport_0_1",
      "type": "candidate-pair",
      "writable": true
    },
    {
      "bytesReceived": 9177296,
      "codecId": "RTCCodec_0_Inbound_111",
      "estimatedPlayoutTimestamp": 3798946151845,
      "fecPacketsDiscarded": 0,
      "fecPacketsReceived": 0,
      "headerBytesReceived": 761600,
      "id": "RTCInboundRTPAudioStream_2203124396",
      "jitter": 0.003,
      "kind": "audio",
      "lastPacketReceivedTimestamp": 128419.069,
      "packetsLost": 810,
      "packetsReceived": 38080,
      "ssrc": 2203124396,
      "timestamp": 1589957352309.487,
      "trackId": "RTCMediaStreamTrack_receiver_1",
      "transportId": "RTCTransport_0_1",
      "type": "inbound-rtp"
    },
    {
      "bytesReceived": 1576355386,
      "codecId": "RTCCodec_1_Inbound_125",
      "decoderImplementation": "ExternalDecoder",
      "estimatedPlayoutTimestamp": 3798940646910,
      "firCount": 0,
      "framesDecoded": 42358,
      "headerBytesReceived": 28137124,
      "id": "RTCInboundRTPVideoStream_953546951",
      "keyFramesDecoded": 69,
      "kind": "video",
      "lastPacketReceivedTimestamp": 128419.083,
      "nackCount": 1197,
      "packetsLost": 14015,
      "packetsReceived": 1371017,
      "pliCount": 132,
      "ssrc": 953546951,
      "timestamp": 1589957352309.487,
      "totalDecodeTime": 196.967,
      "totalInterFrameDelay": 776.6529999999717,
      "totalSquaredInterFrameDelay": 166.27712900002587,
      "trackId": "RTCMediaStreamTrack_receiver_2",
      "transportId": "RTCTransport_0_1",
      "type": "inbound-rtp"
    },
    {
      "audioLevel": 0.10235908078249459,
      "concealedSamples": 1202746,
      "concealmentEvents": 236,
      "detached": false,
      "ended": false,
      "id": "RTCMediaStreamTrack_receiver_1",
      "insertedSamplesForDeceleration": 38876,
      "jitterBufferDelay": 13059292.8,
      "jitterBufferEmittedCount": 36538560,
      "kind": "audio",
      "remoteSource": true,
      "removedSamplesForAcceleration": 439913,
      "silentConcealedSamples": 508944,
      "timestamp": 1589957352309.487,
      "totalAudioEnergy": 17.751000586229022,
      "totalSamplesDuration": 778.1299999994374,
      "totalSamplesReceived": 37339680,
      "trackIdentifier": "544e5453-fa2d-4914-afd2-16080d6240ca",
      "type": "track"
    },
    {
      "detached": false,
      "ended": false,
      "frameHeight": 1080,
      "frameWidth": 1920,
      "framesDecoded": 42358,
      "framesDropped": 1200,
      "framesReceived": 43887,
      "id": "RTCMediaStreamTrack_receiver_2",
      "jitterBufferDelay": 1428.346,
      "jitterBufferEmittedCount": 42947,
      "kind": "video",
      "remoteSource": true,
      "timestamp": 1589957352309.487,
      "trackIdentifier": "fefe92b8-d7e5-4577-bf16-136be909f486",
      "type": "track"
    },
    {
      "bytesReceived": 1652430303,
      "bytesSent": 2128818,
      "dtlsCipher": "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
      "dtlsState": "connected",
      "id": "RTCTransport_0_1",
      "selectedCandidatePairChanges": 1,
      "srtpCipher": "AES_CM_128_HMAC_SHA1_80",
      "timestamp": 1589957352309.487,
      "tlsVersion": "FEFD",
      "type": "transport"
    }
  ]

Below is the metrics returned from Safari:

[
    {
      "bytesReceived": 0,
      "bytesSent": 0,
      "datachannelid": 1,
      "id": "RTCDataChannel_1",
      "label": "messageChannel",
      "messagesReceived": 0,
      "messagesSent": 0,
      "protocol": "",
      "state": "open",
      "timestamp": 1589993832656.0002,
      "type": "data-channel"
    },
    {
      "availableOutgoingBitrate": 300000,
      "bytesReceived": 44177732,
      "bytesSent": 58331,
      "currentRoundTripTime": 0.037,
      "id": "RTCIceCandidatePair_HBXVYpSl_DPb1XCeX",
      "localCandidateId": "RTCIceCandidate_HBXVYpSl",
      "nominated": true,
      "priority": 7926369428982087000,
      "remoteCandidateId": "RTCIceCandidate_DPb1XCeX",
      "requestsReceived": 12,
      "requestsSent": 1,
      "responsesReceived": 12,
      "responsesSent": 12,
      "state": "succeeded",
      "timestamp": 1589993832656.0002,
      "totalRoundTripTime": 0.533,
      "transportId": "RTCTransport_0_1",
      "type": "candidate-pair",
      "writable": true
    },
    {
      "bytesReceived": 279170,
      "codecId": "RTCCodec_1_Inbound_111",
      "id": "RTCInboundRTPAudioStream_2925745122",
      "jitter": 0.008,
      "packetsLost": 1,
      "packetsReceived": 1069,
      "qpSum": 0,
      "ssrc": 2925745122,
      "timestamp": 1589993832656.0002,
      "trackId": "RTCMediaStreamTrack_receiver_2",
      "transportId": "RTCTransport_0_1",
      "type": "inbound-rtp"
    },
    {
      "bytesReceived": 42806229,
      "codecId": "RTCCodec_0_Inbound_98",
      "firCount": 0,
      "framesDecoded": 1205,
      "id": "RTCInboundRTPVideoStream_622671342",
      "nackCount": 49,
      "packetsLost": 15,
      "packetsReceived": 36620,
      "pliCount": 0,
      "qpSum": 0,
      "ssrc": 622671342,
      "timestamp": 1589993832656.0002,
      "trackId": "RTCMediaStreamTrack_receiver_1",
      "transportId": "RTCTransport_0_1",
      "type": "inbound-rtp"
    },
    {
      "detached": false,
      "ended": false,
      "frameHeight": 1080,
      "frameWidth": 1920,
      "framesDecoded": 1205,
      "framesDropped": 0,
      "framesReceived": 1206,
      "id": "RTCMediaStreamTrack_receiver_1",
      "remoteSource": true,
      "timestamp": 1589993832656.0002,
      "trackIdentifier": "270fa8d0-a679-442a-a2c0-90172ff7bc33",
      "type": "track"
    },
    {
      "audioLevel": 0.020386364329966124,
      "detached": false,
      "ended": false,
      "id": "RTCMediaStreamTrack_receiver_2",
      "remoteSource": true,
      "timestamp": 1589993832656.0002,
      "trackIdentifier": "0c66a784-d5d1-4557-bd39-9b66a1c9c49e",
      "type": "track"
    },
    {
      "bytesReceived": 44177732,
      "bytesSent": 58331,
      "id": "RTCTransport_0_1",
      "timestamp": 1589993832656.0002,
      "type": "transport"
    }
  ]
Comment 1 Radar WebKit Bug Importer 2020-06-02 18:21:36 PDT
<rdar://problem/63902458>
Comment 2 youenn fablet 2020-06-04 02:47:14 PDT
https://bugs.webkit.org/show_bug.cgi?id=212702 is adding media source stats.
Comment 3 youenn fablet 2020-06-08 06:40:26 PDT
Adding other missing stats at bug 206645.
Comment 4 youenn fablet 2020-06-08 06:43:03 PDT
After bug 206645, the missing stats will be transport stats:
"dtlsCipher"
"dtlsState"
"selectedCandidatePairChanges"
"srtpCipher"
"tlsVersion"
Comment 5 youenn fablet 2020-06-08 06:58:30 PDT
Created attachment 401331 [details]
Patch
Comment 6 EWS 2020-06-08 11:14:23 PDT
Committed r262728: <https://trac.webkit.org/changeset/262728>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401331 [details].