Title: [238171] trunk
Revision
238171
Author
[email protected]
Date
2018-11-14 06:57:59 -0800 (Wed, 14 Nov 2018)

Log Message

Add support for transport and peerConnection stats
https://bugs.webkit.org/show_bug.cgi?id=191592

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/RTCPeerConnection-getStats.https-expected.txt:
* web-platform-tests/webrtc/RTCRtpReceiver-getStats.https-expected.txt:
* web-platform-tests/webrtc/RTCRtpSender-getStats.https-expected.txt:
* web-platform-tests/webrtc/getstats-expected.txt:

Source/ThirdParty/libwebrtc:

* Configurations/libwebrtc.iOS.exp:
* Configurations/libwebrtc.iOSsim.exp:
* Configurations/libwebrtc.mac.exp:

Source/WebCore:

Covered by rebased tests.

* Modules/mediastream/RTCStatsReport.h:
(WebCore::RTCStatsReport::TransportStats::TransportStats):
(WebCore::RTCStatsReport::PeerConnectionStats::PeerConnectionStats):
* Modules/mediastream/RTCStatsReport.idl:
* Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
(WebCore::fillRTCTransportStats):
(WebCore::fillRTCPeerConnectionStats):
(WebCore::LibWebRTCStatsCollector::OnStatsDelivered):

LayoutTests:

* webrtc/video-stats.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238170 => 238171)


--- trunk/LayoutTests/ChangeLog	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/ChangeLog	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,3 +1,12 @@
+2018-11-14  Youenn Fablet  <[email protected]>
+
+        Add support for transport and peerConnection stats
+        https://bugs.webkit.org/show_bug.cgi?id=191592
+
+        Reviewed by Alex Christensen.
+
+        * webrtc/video-stats.html:
+
 2018-11-14  Ali Juma  <[email protected]>
 
         Transform of composited layer not updated when layer also needs repaint

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (238170 => 238171)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,3 +1,15 @@
+2018-11-14  Youenn Fablet  <[email protected]>
+
+        Add support for transport and peerConnection stats
+        https://bugs.webkit.org/show_bug.cgi?id=191592
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/webrtc/RTCPeerConnection-getStats.https-expected.txt:
+        * web-platform-tests/webrtc/RTCRtpReceiver-getStats.https-expected.txt:
+        * web-platform-tests/webrtc/RTCRtpSender-getStats.https-expected.txt:
+        * web-platform-tests/webrtc/getstats-expected.txt:
+
 2018-11-13  Youenn Fablet  <[email protected]>
 
         RTCPeerConnection.getTransceivers is not always exposing all transceivers

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-getStats.https-expected.txt (238170 => 238171)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-getStats.https-expected.txt	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-getStats.https-expected.txt	2018-11-14 14:57:59 UTC (rev 238171)
@@ -6,9 +6,9 @@
 PASS getStats() with track added via addTransceiver should succeed 
 FAIL getStats() with track associated with more than one sender should reject with InvalidAccessError assert_unreached: Should have rejected: undefined Reached unreachable code
 FAIL getStats() with track associated with both sender and receiver should reject with InvalidAccessError assert_unreached: Should have rejected: undefined Reached unreachable code
-FAIL getStats() with no argument should return stats report containing peer-connection stats on an empty PC assert_true: Expect statsReport to contain stats object of type peer-connection expected true got false
-FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type peer-connection expected true got false
-FAIL getStats() with no argument should return stats for no-stream tracks assert_true: Expect statsReport to contain stats object of type peer-connection expected true got false
+PASS getStats() with no argument should return stats report containing peer-connection stats on an empty PC 
+FAIL getStats() with no argument should return stats report containing peer-connection stats and outbound-track-stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
+FAIL getStats() with no argument should return stats for no-stream tracks assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
 FAIL getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats assert_true: Expect statsReport to contain stats object of type outbound-rtp expected true got false
 FAIL getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats assert_true: Expect statsReport to contain stats object of type inbound-rtp expected true got false
 FAIL getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats assert_unreached: test failed with error: Error: assert_true: Expect dictionary.dataChannelIdentifier to be integer expected true got false Reached unreachable code

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https-expected.txt (238170 => 238171)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https-expected.txt	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getStats.https-expected.txt	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,4 +1,4 @@
 
-FAIL receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats assert_true: Expect stats report to have stats object with id RTCTransport_0_1 expected true got false
-FAIL receiver.getStats() via addTrack should return stats report containing inbound-rtp stats assert_true: Expect stats report to have stats object with id RTCTransport_0_1 expected true got false
+FAIL receiver.getStats() via addTransceiver should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
+FAIL receiver.getStats() via addTrack should return stats report containing inbound-rtp stats assert_equals: Expect dictionary.codecId to be string expected "string" but got "undefined"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpSender-getStats.https-expected.txt (238170 => 238171)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpSender-getStats.https-expected.txt	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpSender-getStats.https-expected.txt	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,4 +1,4 @@
 
-FAIL sender.getStats() via addTransceiver should return stats report containing outbound-rtp stats assert_true: Expect stats report to have stats object with id RTCTransport_0_1 expected true got false
-FAIL sender.getStats() via addTrack should return stats report containing outbound-rtp stats assert_true: Expect stats report to have stats object with id RTCTransport_0_1 expected true got false
+FAIL sender.getStats() via addTransceiver should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.remoteId to be string expected "string" but got "undefined"
+FAIL sender.getStats() via addTrack should return stats report containing outbound-rtp stats assert_equals: Expect dictionary.remoteId to be string expected "string" but got "undefined"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/getstats-expected.txt (238170 => 238171)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/getstats-expected.txt	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/getstats-expected.txt	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,28 +1,28 @@
 
-FAIL Can get stats from a basic WebRTC call. assert_unreached: Error: assert_not_equals: Did not find peer-connection stats got disallowed value null:  Reached unreachable code
+PASS Can get stats from a basic WebRTC call. 
 Retrieved stats info
 
   
 {
-  "RTCCertificate_72:C3:4E:3B:12:BE:99:87:31:C4:16:70:DE:76:18:C3:83:4C:1F:B9:8F:69:B5:5B:94:9D:16:0D:89:2A:2C:DA": {
-    "id": "RTCCertificate_72:C3:4E:3B:12:BE:99:87:31:C4:16:70:DE:76:18:C3:83:4C:1F:B9:8F:69:B5:5B:94:9D:16:0D:89:2A:2C:DA",
-    "timestamp": 1542081514259,
+  "RTCCertificate_E6:B4:F7:7C:4A:9E:86:FB:65:54:55:DE:E7:04:81:CA:A5:FD:21:9F:B2:92:EE:21:EF:C2:44:E7:1D:4E:E8:86": {
+    "id": "RTCCertificate_E6:B4:F7:7C:4A:9E:86:FB:65:54:55:DE:E7:04:81:CA:A5:FD:21:9F:B2:92:EE:21:EF:C2:44:E7:1D:4E:E8:86",
+    "timestamp": 1542138647360.0002,
     "type": "certificate",
-    "base64Certificate": "MIIBFTCBvaADAgECAgkAwIkqz13X/yUwCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE4MTExMjAzNTgzNFoXDTE4MTIxMzAzNTgzNFowETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEF8DRQKRVSaeSE6DYYrunTtelaVLTmQjNX/CcpjaYA4tZPOnxsydILwUCKptAFnXyWGThqnMrHyZn5Oy+m7/3kzAKBggqhkjOPQQDAgNHADBEAiAoOPDE8VAvuMVGM1/rMBUppHYImPXpN6/8GSpTWZncXQIgHTn4Da4sgzsLUrqRE+ZR7LpjHs9W4kj/hi/qvqOIxdE=",
-    "fingerprint": "72:C3:4E:3B:12:BE:99:87:31:C4:16:70:DE:76:18:C3:83:4C:1F:B9:8F:69:B5:5B:94:9D:16:0D:89:2A:2C:DA",
+    "base64Certificate": "MIIBFzCBvaADAgECAgkAmUOKhXabECcwCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE4MTExMjE5NTA0N1oXDTE4MTIxMzE5NTA0N1owETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEpv51bCUk/FtnnFXwLUaHKwVoBX/fjpq0wXV5QuxjLd4GLBJb1nD014bmUlw63Pizl4nRoQBIfyOFAdbW9UUKHzAKBggqhkjOPQQDAgNJADBGAiEAjhJk8wni+BCZZeHqX0nGwANgtIm1ZwAywWaa5+selbICIQCwGDEehbP+MfZ62tfej4avrohy4ykO5xC1+5fL0zmZQQ==",
+    "fingerprint": "E6:B4:F7:7C:4A:9E:86:FB:65:54:55:DE:E7:04:81:CA:A5:FD:21:9F:B2:92:EE:21:EF:C2:44:E7:1D:4E:E8:86",
     "fingerprintAlgorithm": "sha-256"
   },
-  "RTCCertificate_9C:56:95:9E:F9:F9:91:53:5E:89:E7:7C:56:88:68:CF:D3:6D:30:6C:F5:F8:5E:23:18:73:A5:9A:24:0D:E2:EC": {
-    "id": "RTCCertificate_9C:56:95:9E:F9:F9:91:53:5E:89:E7:7C:56:88:68:CF:D3:6D:30:6C:F5:F8:5E:23:18:73:A5:9A:24:0D:E2:EC",
-    "timestamp": 1542081514259,
+  "RTCCertificate_FF:81:96:D2:F0:D3:75:95:AE:08:99:64:8A:95:F3:1F:27:51:38:3E:83:C5:2D:17:1D:41:5B:F5:36:1E:22:AC": {
+    "id": "RTCCertificate_FF:81:96:D2:F0:D3:75:95:AE:08:99:64:8A:95:F3:1F:27:51:38:3E:83:C5:2D:17:1D:41:5B:F5:36:1E:22:AC",
+    "timestamp": 1542138647360.0002,
     "type": "certificate",
-    "base64Certificate": "MIIBFzCBvaADAgECAgkAtnR4OnwgdOEwCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE4MTExMjAzNTgzNFoXDTE4MTIxMzAzNTgzNFowETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEB3PZCOtymnvdfPJEw9T+7CylFh++TqD7o34WQDbVxxctutiz7sSgkUOCC/NGjQOFKaX0wk97AoULq+wdIl5ckTAKBggqhkjOPQQDAgNJADBGAiEAzvr09HhfrgqbiCpGu1hEEzClBG8HV9IVda6Rvt/719YCIQDNABFsUCED1JxDlc7b3610JTqIqUrhXWindK4YlU0GVQ==",
-    "fingerprint": "9C:56:95:9E:F9:F9:91:53:5E:89:E7:7C:56:88:68:CF:D3:6D:30:6C:F5:F8:5E:23:18:73:A5:9A:24:0D:E2:EC",
+    "base64Certificate": "MIIBFjCBvaADAgECAgkA0YyL/axVxyUwCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE4MTExMjE5NTA0N1oXDTE4MTIxMzE5NTA0N1owETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEHUTz7lUs8fxFqSOEMl04JHlyj2PItG98Q6C/W2+vwKlflcVRV3wGUsRLwwENbuDEH95U4VY0F7KWNgqG8W5eEzAKBggqhkjOPQQDAgNIADBFAiBiJZQlXIgiIsCUAoJv8uzAsUl/US6MiknEkA9OABXDbwIhANaTPbugE7/Ly/9R0zqlu21V1YfF/v6H34oX/wiOyf2p",
+    "fingerprint": "FF:81:96:D2:F0:D3:75:95:AE:08:99:64:8A:95:F3:1F:27:51:38:3E:83:C5:2D:17:1D:41:5B:F5:36:1E:22:AC",
     "fingerprintAlgorithm": "sha-256"
   },
   "RTCDataChannel_1": {
     "id": "RTCDataChannel_1",
-    "timestamp": 1542081514259,
+    "timestamp": 1542138647360.0002,
     "type": "data-channel",
     "bytesReceived": 0,
     "bytesSent": 0,
@@ -33,17 +33,17 @@
     "protocol": "",
     "state": "open"
   },
-  "RTCIceCandidatePair_s1xoaivx_5MfaqFll": {
-    "id": "RTCIceCandidatePair_s1xoaivx_5MfaqFll",
-    "timestamp": 1542081514259,
+  "RTCIceCandidatePair_z6z3iTpo_9P4G3ojB": {
+    "id": "RTCIceCandidatePair_z6z3iTpo_9P4G3ojB",
+    "timestamp": 1542138647360.0002,
     "type": "candidate-pair",
-    "bytesReceived": 695,
-    "bytesSent": 1307,
+    "bytesReceived": 694,
+    "bytesSent": 1309,
     "currentRoundTripTime": 0.003,
-    "localCandidateId": "RTCIceCandidate_s1xoaivx",
+    "localCandidateId": "RTCIceCandidate_z6z3iTpo",
     "nominated": true,
     "priority": 9079290933572287000,
-    "remoteCandidateId": "RTCIceCandidate_5MfaqFll",
+    "remoteCandidateId": "RTCIceCandidate_9P4G3ojB",
     "requestsReceived": 1,
     "requestsSent": 1,
     "responsesReceived": 1,
@@ -53,16 +53,16 @@
     "transportId": "RTCTransport_0_1",
     "writable": true
   },
-  "RTCIceCandidatePair_s1xoaivx_7dkYAhKQ": {
-    "id": "RTCIceCandidatePair_s1xoaivx_7dkYAhKQ",
-    "timestamp": 1542081514259,
+  "RTCIceCandidatePair_z6z3iTpo_OlinD0xX": {
+    "id": "RTCIceCandidatePair_z6z3iTpo_OlinD0xX",
+    "timestamp": 1542138647360.0002,
     "type": "candidate-pair",
     "bytesReceived": 0,
     "bytesSent": 0,
-    "localCandidateId": "RTCIceCandidate_s1xoaivx",
+    "localCandidateId": "RTCIceCandidate_z6z3iTpo",
     "nominated": false,
     "priority": 9079290933572287000,
-    "remoteCandidateId": "RTCIceCandidate_7dkYAhKQ",
+    "remoteCandidateId": "RTCIceCandidate_OlinD0xX",
     "requestsReceived": 0,
     "requestsSent": 0,
     "responsesReceived": 0,
@@ -72,38 +72,55 @@
     "transportId": "RTCTransport_0_1",
     "writable": false
   },
-  "RTCIceCandidate_5MfaqFll": {
-    "id": "RTCIceCandidate_5MfaqFll",
-    "timestamp": 1542081514259,
+  "RTCIceCandidate_9P4G3ojB": {
+    "id": "RTCIceCandidate_9P4G3ojB",
+    "timestamp": 1542138647360.0002,
     "type": "remote-candidate",
     "candidateType": "host",
     "deleted": false,
-    "port": 60324,
+    "port": 62426,
     "priority": 2113937151,
     "protocol": "udp",
     "transportId": "RTCTransport_0_1"
   },
-  "RTCIceCandidate_7dkYAhKQ": {
-    "id": "RTCIceCandidate_7dkYAhKQ",
-    "timestamp": 1542081514259,
+  "RTCIceCandidate_OlinD0xX": {
+    "id": "RTCIceCandidate_OlinD0xX",
+    "timestamp": 1542138647360.0002,
     "type": "remote-candidate",
     "candidateType": "host",
     "deleted": false,
-    "port": 60905,
+    "port": 54933,
     "priority": 2113937151,
     "protocol": "udp",
     "transportId": "RTCTransport_0_1"
   },
-  "RTCIceCandidate_s1xoaivx": {
-    "id": "RTCIceCandidate_s1xoaivx",
-    "timestamp": 1542081514259,
+  "RTCIceCandidate_z6z3iTpo": {
+    "id": "RTCIceCandidate_z6z3iTpo",
+    "timestamp": 1542138647360.0002,
     "type": "local-candidate",
     "candidateType": "host",
     "deleted": false,
-    "port": 62505,
+    "port": 53616,
     "priority": 2113937151,
     "protocol": "udp",
     "transportId": "RTCTransport_0_1"
+  },
+  "RTCPeerConnection": {
+    "id": "RTCPeerConnection",
+    "timestamp": 1542138647360.0002,
+    "type": "peer-connection",
+    "dataChannelsClosed": 0,
+    "dataChannelsOpened": 1
+  },
+  "RTCTransport_0_1": {
+    "id": "RTCTransport_0_1",
+    "timestamp": 1542138647360.0002,
+    "type": "transport",
+    "bytesReceived": 694,
+    "bytesSent": 1309,
+    "localCertificateId": "RTCCertificate_E6:B4:F7:7C:4A:9E:86:FB:65:54:55:DE:E7:04:81:CA:A5:FD:21:9F:B2:92:EE:21:EF:C2:44:E7:1D:4E:E8:86",
+    "remoteCertificateId": "RTCCertificate_FF:81:96:D2:F0:D3:75:95:AE:08:99:64:8A:95:F3:1F:27:51:38:3E:83:C5:2D:17:1D:41:5B:F5:36:1E:22:AC",
+    "selectedCandidatePairId": "RTCIceCandidatePair_z6z3iTpo_9P4G3ojB"
   }
 }
 

Modified: trunk/LayoutTests/webrtc/video-stats.html (238170 => 238171)


--- trunk/LayoutTests/webrtc/video-stats.html	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/LayoutTests/webrtc/video-stats.html	2018-11-14 14:57:59 UTC (rev 238171)
@@ -137,10 +137,10 @@
     await checkOutboundFramesNumberIncreased(firstConnection, statsFirstConnection, 0);
 
     let types = await getStatsType(firstConnection);
-    assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "outbound-rtp", "remote-candidate", "track"]);
+    assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "outbound-rtp", "peer-connection", "remote-candidate", "track", "transport"]);
 
     types = await getStatsType(secondConnection);
-    assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "outbound-rtp", "remote-candidate", "track"]);
+    assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "outbound-rtp", "peer-connection", "remote-candidate", "track", "transport"]);
 }, "Basic video stats");
 
 promise_test(async (test) => {

Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (238170 => 238171)


--- trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,3 +1,14 @@
+2018-11-14  Youenn Fablet  <[email protected]>
+
+        Add support for transport and peerConnection stats
+        https://bugs.webkit.org/show_bug.cgi?id=191592
+
+        Reviewed by Alex Christensen.
+
+        * Configurations/libwebrtc.iOS.exp:
+        * Configurations/libwebrtc.iOSsim.exp:
+        * Configurations/libwebrtc.mac.exp:
+
 2018-11-07  Youenn Fablet  <[email protected]>
 
         webrtc/datachannel/basic-tcp.html will crash with an invalid crash

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (238170 => 238171)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp	2018-11-14 14:57:59 UTC (rev 238171)
@@ -21,6 +21,8 @@
 __ZN6webrtc10VideoFrameC1ERKN3rtc13scoped_refptrINS_16VideoFrameBufferEEENS_13VideoRotationEx
 __ZN6webrtc10VideoFrameD1Ev
 __ZN6webrtc13RTCCodecStats5kTypeE
+__ZN6webrtc22RTCPeerConnectionStats5kTypeE
+__ZN6webrtc17RTCTransportStats5kTypeE
 __ZN6webrtc13RtpParametersD1Ev
 __ZN6webrtc14I420BufferPool12CreateBufferEii
 __ZN6webrtc14I420BufferPoolC1Ebm

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (238170 => 238171)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp	2018-11-14 14:57:59 UTC (rev 238171)
@@ -21,6 +21,8 @@
 __ZN6webrtc10VideoFrameC1ERKN3rtc13scoped_refptrINS_16VideoFrameBufferEEENS_13VideoRotationEx
 __ZN6webrtc10VideoFrameD1Ev
 __ZN6webrtc13RTCCodecStats5kTypeE
+__ZN6webrtc22RTCPeerConnectionStats5kTypeE
+__ZN6webrtc17RTCTransportStats5kTypeE
 __ZN6webrtc13RtpParametersD1Ev
 __ZN6webrtc14I420BufferPool12CreateBufferEii
 __ZN6webrtc14I420BufferPoolC1Ebm

Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (238170 => 238171)


--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp	2018-11-14 14:57:59 UTC (rev 238171)
@@ -21,6 +21,8 @@
 __ZN6webrtc10VideoFrameC1ERKN3rtc13scoped_refptrINS_16VideoFrameBufferEEENS_13VideoRotationEx
 __ZN6webrtc10VideoFrameD1Ev
 __ZN6webrtc13RTCCodecStats5kTypeE
+__ZN6webrtc22RTCPeerConnectionStats5kTypeE
+__ZN6webrtc17RTCTransportStats5kTypeE
 __ZN6webrtc13RtpParametersD1Ev
 __ZN6webrtc14I420BufferPool12CreateBufferEii
 __ZN6webrtc14I420BufferPoolC1Ebm

Modified: trunk/Source/WebCore/ChangeLog (238170 => 238171)


--- trunk/Source/WebCore/ChangeLog	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/WebCore/ChangeLog	2018-11-14 14:57:59 UTC (rev 238171)
@@ -1,3 +1,21 @@
+2018-11-14  Youenn Fablet  <[email protected]>
+
+        Add support for transport and peerConnection stats
+        https://bugs.webkit.org/show_bug.cgi?id=191592
+
+        Reviewed by Alex Christensen.
+
+        Covered by rebased tests.
+
+        * Modules/mediastream/RTCStatsReport.h:
+        (WebCore::RTCStatsReport::TransportStats::TransportStats):
+        (WebCore::RTCStatsReport::PeerConnectionStats::PeerConnectionStats):
+        * Modules/mediastream/RTCStatsReport.idl:
+        * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
+        (WebCore::fillRTCTransportStats):
+        (WebCore::fillRTCPeerConnectionStats):
+        (WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
+
 2018-11-14  Ali Juma  <[email protected]>
 
         Transform of composited layer not updated when layer also needs repaint

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h (238170 => 238171)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h	2018-11-14 14:57:59 UTC (rev 238171)
@@ -217,6 +217,24 @@
         String implementation;
     };
 
+    struct TransportStats : Stats {
+        TransportStats() { type = RTCStatsReport::Type::Transport; }
+
+        std::optional<uint64_t> bytesSent;
+        std::optional<uint64_t> bytesReceived;
+        String rtcpTransportStatsId;
+        String selectedCandidatePairId;
+        String localCertificateId;
+        String remoteCertificateId;
+    };
+
+    struct PeerConnectionStats : Stats {
+        PeerConnectionStats() { type = RTCStatsReport::Type::PeerConnection; }
+
+        std::optional<uint32_t> dataChannelsOpened;
+        std::optional<uint32_t> dataChannelsClosed;
+    };
+
 private:
     RTCStatsReport() = default;
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl (238170 => 238171)


--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl	2018-11-14 14:57:59 UTC (rev 238171)
@@ -211,7 +211,32 @@
     DOMString implementation;
 };
 
-// FIXME 169662: missing RTCPeerConnectionStats
+[ JSGenerateToJSObject ]
+dictionary RTCTransportStats : RTCStats {
+    // FIXME 169662: Support more fields.
+    // unsigned long packetsSent;
+    // unsigned long packetsReceived;
+    unsigned long long bytesSent;
+    unsigned long long bytesReceived;
+    DOMString rtcpTransportStatsId;
+    // RTCIceRole iceRole;
+    // RTCDtlsTransportState dtlsState;
+    DOMString selectedCandidatePairId;
+    DOMString localCertificateId;
+    DOMString remoteCertificateId;
+    // DOMString tlsVersion;
+    // DOMString dtlsCipher;
+    // DOMString srtpCipher;
+    // DOMString tlsGroup;
+};
+
+[ JSGenerateToJSObject ]
+dictionary RTCPeerConnectionStats : RTCStats {
+    // FIXME 169662: Support more fields.
+    unsigned long dataChannelsOpened;
+    unsigned long dataChannelsClosed;
+    // unsigned long dataChannelsRequested;
+    // unsigned long dataChannelsAccepted;
+};
+
 // FIXME 169662: missing RTCMediaStreamStats
-// FIXME 169662: missing RTCTransportStats
-// FIXME 169662: missing RTCIceCandidateStats

Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp (238170 => 238171)


--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp	2018-11-14 13:13:16 UTC (rev 238170)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp	2018-11-14 14:57:59 UTC (rev 238171)
@@ -353,6 +353,34 @@
         stats.implementation = fromStdString(*rtcStats.implementation);
 }
 
+static inline void fillRTCTransportStats(RTCStatsReport::TransportStats& stats, const webrtc::RTCTransportStats& rtcStats)
+{
+    fillRTCStats(stats, rtcStats);
+
+    if (rtcStats.bytes_sent.is_defined())
+        stats.bytesSent = *rtcStats.bytes_sent;
+    if (rtcStats.bytes_received.is_defined())
+        stats.bytesReceived = *rtcStats.bytes_received;
+    if (rtcStats.rtcp_transport_stats_id.is_defined())
+        stats.rtcpTransportStatsId = fromStdString(*rtcStats.rtcp_transport_stats_id);
+    if (rtcStats.selected_candidate_pair_id.is_defined())
+        stats.selectedCandidatePairId = fromStdString(*rtcStats.selected_candidate_pair_id);
+    if (rtcStats.local_certificate_id.is_defined())
+        stats.localCertificateId = fromStdString(*rtcStats.local_certificate_id);
+    if (rtcStats.remote_certificate_id.is_defined())
+        stats.remoteCertificateId = fromStdString(*rtcStats.remote_certificate_id);
+}
+
+static inline void fillRTCPeerConnectionStats(RTCStatsReport::PeerConnectionStats& stats, const webrtc::RTCPeerConnectionStats& rtcStats)
+{
+    fillRTCStats(stats, rtcStats);
+
+    if (rtcStats.data_channels_opened.is_defined())
+        stats.dataChannelsOpened = *rtcStats.data_channels_opened;
+    if (rtcStats.data_channels_closed.is_defined())
+        stats.dataChannelsClosed = *rtcStats.data_channels_closed;
+}
+
 void LibWebRTCStatsCollector::OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>& rtcReport)
 {
     callOnMainThread([protectedThis = rtc::scoped_refptr<LibWebRTCStatsCollector>(this), rtcReport] {
@@ -395,6 +423,14 @@
                 RTCStatsReport::CodecStats stats;
                 fillRTCCodecStats(stats, static_cast<const webrtc::RTCCodecStats&>(rtcStats));
                 report->addStats<IDLDictionary<RTCStatsReport::CodecStats>>(WTFMove(stats));
+            } else if (rtcStats.type() == webrtc::RTCTransportStats::kType) {
+                RTCStatsReport::TransportStats stats;
+                fillRTCTransportStats(stats, static_cast<const webrtc::RTCTransportStats&>(rtcStats));
+                report->addStats<IDLDictionary<RTCStatsReport::TransportStats>>(WTFMove(stats));
+            } else if (rtcStats.type() == webrtc::RTCPeerConnectionStats::kType) {
+                RTCStatsReport::PeerConnectionStats stats;
+                fillRTCPeerConnectionStats(stats, static_cast<const webrtc::RTCPeerConnectionStats&>(rtcStats));
+                report->addStats<IDLDictionary<RTCStatsReport::PeerConnectionStats>>(WTFMove(stats));
             }
         }
     });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to