Diff
Modified: trunk/LayoutTests/ChangeLog (236962 => 236963)
--- trunk/LayoutTests/ChangeLog 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/LayoutTests/ChangeLog 2018-10-09 15:44:34 UTC (rev 236963)
@@ -1,3 +1,15 @@
+2018-10-09 Youenn Fablet <you...@apple.com>
+
+ Add support for IceCandidate stats
+ https://bugs.webkit.org/show_bug.cgi?id=190329
+
+ Reviewed by Eric Carlson.
+
+ * webrtc/candidate-stats-expected.txt: Added.
+ * webrtc/candidate-stats.html: Added.
+ * webrtc/routines.js:
+ * webrtc/video-stats.html:
+
2018-10-09 Philippe Normand <pnorm...@igalia.com>
[GStreamer] Stealing cross-origin video pixel with HLS
Added: trunk/LayoutTests/webrtc/candidate-stats-expected.txt (0 => 236963)
--- trunk/LayoutTests/webrtc/candidate-stats-expected.txt (rev 0)
+++ trunk/LayoutTests/webrtc/candidate-stats-expected.txt 2018-10-09 15:44:34 UTC (rev 236963)
@@ -0,0 +1,3 @@
+
+PASS ICE candidate data channel stats
+
Added: trunk/LayoutTests/webrtc/candidate-stats.html (0 => 236963)
--- trunk/LayoutTests/webrtc/candidate-stats.html (rev 0)
+++ trunk/LayoutTests/webrtc/candidate-stats.html 2018-10-09 15:44:34 UTC (rev 236963)
@@ -0,0 +1,41 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing basic video exchange from offerer to receiver</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script src =""
+ <script>
+promise_test(async (test) => {
+ let firstConnection, secondConnection;
+ await new Promise((resolve, reject) => {
+ createConnections((connection) => {
+ firstConnection = connection;
+ localChannel = connection.createDataChannel('sendDataChannel');
+ }, (connection) => {
+ secondConnection = connection;
+ connection._ondatachannel_ = resolve;
+ });
+ setTimeout(() => { reject("Test timed out"); }, 5000);
+ });
+
+ let stats = await getTypedStats(firstConnection, "local-candidate");
+ assert_true(!stats.address, "address is not exposed");
+ assert_true(!stats.networkType, "networkType is not exposed");
+
+ assert_array_equals(Object.keys(stats), ["id","timestamp","type","candidateType","deleted","port","priority","protocol","transportId"], "local");
+
+ stats = await getTypedStats(firstConnection, "remote-candidate");
+
+ // For now, we do not want to expose address or networkType.
+ assert_true(!stats.address, "address is not exposed");
+ assert_true(!stats.networkType, "networkType is not exposed");
+
+ assert_array_equals(Object.keys(stats), ["id","timestamp","type","candidateType","deleted","port","priority","protocol","transportId"], "remote");
+}, "ICE candidate data channel stats");
+ </script>
+ </body>
+</html>
Modified: trunk/LayoutTests/webrtc/routines.js (236962 => 236963)
--- trunk/LayoutTests/webrtc/routines.js 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/LayoutTests/webrtc/routines.js 2018-10-09 15:44:34 UTC (rev 236963)
@@ -211,3 +211,14 @@
return line.indexOf('a=fmtp') === -1 && line.indexOf('a=rtcp-fb') === -1 && (line.indexOf('a=rtpmap') === -1 || line.indexOf(codec) !== -1);
}).join('\r\n');
}
+
+async function getTypedStats(connection, type)
+{
+ const report = await connection.getStats();
+ var stats;
+ report.forEach((statItem) => {
+ if (statItem.type === type)
+ stats = statItem;
+ });
+ return stats;
+}
Modified: trunk/LayoutTests/webrtc/video-stats.html (236962 => 236963)
--- trunk/LayoutTests/webrtc/video-stats.html 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/LayoutTests/webrtc/video-stats.html 2018-10-09 15:44:34 UTC (rev 236963)
@@ -137,10 +137,10 @@
await checkOutboundFramesNumberIncreased(firstConnection, statsFirstConnection, 0);
let types = await getStatsType(firstConnection);
- assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "outbound-rtp", "track"]);
+ assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "outbound-rtp", "remote-candidate", "track"]);
types = await getStatsType(secondConnection);
- assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "outbound-rtp", "track"]);
+ assert_array_equals(types, ["candidate-pair", "certificate", "codec", "inbound-rtp", "local-candidate", "outbound-rtp", "remote-candidate", "track"]);
}, "Basic video stats");
promise_test(async (test) => {
Modified: trunk/Source/ThirdParty/libwebrtc/ChangeLog (236962 => 236963)
--- trunk/Source/ThirdParty/libwebrtc/ChangeLog 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/ThirdParty/libwebrtc/ChangeLog 2018-10-09 15:44:34 UTC (rev 236963)
@@ -1,3 +1,16 @@
+2018-10-09 Youenn Fablet <you...@apple.com>
+
+ Add support for IceCandidate stats
+ https://bugs.webkit.org/show_bug.cgi?id=190329
+
+ Reviewed by Eric Carlson.
+
+ Export new stats kType values.
+
+ * Configurations/libwebrtc.iOS.exp:
+ * Configurations/libwebrtc.iOSsim.exp:
+ * Configurations/libwebrtc.mac.exp:
+
2018-10-06 Dan Bernstein <m...@apple.com>
[Xcode] Never build yasm with ASAN
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp (236962 => 236963)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOS.exp 2018-10-09 15:44:34 UTC (rev 236963)
@@ -216,3 +216,5 @@
__ZN6webrtc18RtpTransceiverInitD1Ev
__ZN6webrtc9RtpSourceD1Ev
__ZN6webrtc11field_trial25InitFieldTrialsFromStringEPKc
+__ZN6webrtc25RTCLocalIceCandidateStats5kTypeE
+__ZN6webrtc26RTCRemoteIceCandidateStats5kTypeE
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp (236962 => 236963)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.iOSsim.exp 2018-10-09 15:44:34 UTC (rev 236963)
@@ -217,3 +217,5 @@
__ZN6webrtc18RtpTransceiverInitD1Ev
__ZN6webrtc9RtpSourceD1Ev
__ZN6webrtc11field_trial25InitFieldTrialsFromStringEPKc
+__ZN6webrtc25RTCLocalIceCandidateStats5kTypeE
+__ZN6webrtc26RTCRemoteIceCandidateStats5kTypeE
Modified: trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp (236962 => 236963)
--- trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/ThirdParty/libwebrtc/Configurations/libwebrtc.mac.exp 2018-10-09 15:44:34 UTC (rev 236963)
@@ -217,3 +217,5 @@
__ZN6webrtc18RtpTransceiverInitD1Ev
__ZN6webrtc9RtpSourceD1Ev
__ZN6webrtc11field_trial25InitFieldTrialsFromStringEPKc
+__ZN6webrtc25RTCLocalIceCandidateStats5kTypeE
+__ZN6webrtc26RTCRemoteIceCandidateStats5kTypeE
Modified: trunk/Source/WebCore/ChangeLog (236962 => 236963)
--- trunk/Source/WebCore/ChangeLog 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/WebCore/ChangeLog 2018-10-09 15:44:34 UTC (rev 236963)
@@ -1,3 +1,23 @@
+2018-10-09 Youenn Fablet <you...@apple.com>
+
+ Add support for IceCandidate stats
+ https://bugs.webkit.org/show_bug.cgi?id=190329
+
+ Reviewed by Eric Carlson.
+
+ Convert IceCandidate stats gathered by libwebrtc.
+ Since networkType might be sensitive information, we currently do not expose it.
+ We do not expose address either if it is a host or prflx candidate.
+
+ Test: webrtc/candidate-stats.html
+
+ * Modules/mediastream/RTCStatsReport.h:
+ * Modules/mediastream/RTCStatsReport.idl:
+ * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
+ (WebCore::iceCandidateState):
+ (WebCore::fillRTCIceCandidateStats):
+ (WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
+
2018-10-09 Philippe Normand <pnorm...@igalia.com>
[GStreamer] Stealing cross-origin video pixel with HLS
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h (236962 => 236963)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h 2018-10-09 15:44:34 UTC (rev 236963)
@@ -177,6 +177,19 @@
unsigned long long consentResponsesSent { 0 };
};
+ enum class IceCandidateType { Host, Srflx, Prflx, Relay };
+
+ struct IceCandidateStats : Stats {
+ String transportId;
+ String address;
+ std::optional<int32_t> port;
+ String protocol;
+ std::optional<IceCandidateType> candidateType;
+ std::optional<int32_t> priority;
+ String url;
+ bool deleted { false };
+ };
+
struct CertificateStats : Stats {
CertificateStats() { type = RTCStatsReport::Type::Certificate; }
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl (236962 => 236963)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.idl 2018-10-09 15:44:34 UTC (rev 236963)
@@ -165,7 +165,28 @@
// FIXME: Expose other fields once libwebrtc support them.
};
+enum RTCIceCandidateType {
+ "host",
+ "srflx",
+ "prflx",
+ "relay"
+};
+
[ JSGenerateToJSObject ]
+dictionary RTCIceCandidateStats : RTCStats {
+ DOMString transportId;
+ // FIXME: decide whether to expose networkType
+ // FIXME: Expose relayProtocol
+ DOMString address;
+ long port;
+ DOMString protocol;
+ RTCIceCandidateType candidateType;
+ long priority;
+ DOMString url;
+ boolean deleted = false;
+};
+
+[ JSGenerateToJSObject ]
dictionary RTCCertificateStats : RTCStats {
DOMString fingerprint;
DOMString fingerprintAlgorithm;
@@ -194,4 +215,3 @@
// FIXME 169662: missing RTCMediaStreamStats
// FIXME 169662: missing RTCTransportStats
// FIXME 169662: missing RTCIceCandidateStats
-// FIXME 169662: missing RTCStatsIceCandidatePairState
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp (236962 => 236963)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp 2018-10-09 15:31:31 UTC (rev 236962)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp 2018-10-09 15:44:34 UTC (rev 236963)
@@ -278,6 +278,51 @@
stats.consentResponsesSent = *rtcStats.responses_sent;
}
+static inline std::optional<RTCStatsReport::IceCandidateType> iceCandidateState(const std::string& state)
+{
+ if (state == "host")
+ return RTCStatsReport::IceCandidateType::Host;
+ if (state == "srflx")
+ return RTCStatsReport::IceCandidateType::Srflx;
+ if (state == "prflx")
+ return RTCStatsReport::IceCandidateType::Prflx;
+ if (state == "relay")
+ return RTCStatsReport::IceCandidateType::Relay;
+
+ return { };
+}
+
+static inline void fillRTCIceCandidateStats(RTCStatsReport::IceCandidateStats& stats, const webrtc::RTCIceCandidateStats& rtcStats)
+{
+ stats.type = rtcStats.type() == webrtc::RTCRemoteIceCandidateStats::kType ? RTCStatsReport::Type::RemoteCandidate : RTCStatsReport::Type::LocalCandidate;
+
+ fillRTCStats(stats, rtcStats);
+
+ if (rtcStats.transport_id.is_defined())
+ stats.transportId = fromStdString(*rtcStats.transport_id);
+ if (rtcStats.ip.is_defined())
+ stats.address = fromStdString(*rtcStats.ip);
+ if (rtcStats.port.is_defined())
+ stats.port = *rtcStats.port;
+ if (rtcStats.protocol.is_defined())
+ stats.protocol = fromStdString(*rtcStats.protocol);
+
+ if (rtcStats.candidate_type.is_defined())
+ stats.candidateType = iceCandidateState(*rtcStats.candidate_type);
+
+ if (stats.candidateType == RTCStatsReport::IceCandidateType::Prflx)
+ stats.candidateType = { };
+ if (stats.candidateType == RTCStatsReport::IceCandidateType::Prflx || stats.candidateType == RTCStatsReport::IceCandidateType::Host)
+ stats.address = { };
+
+ if (rtcStats.priority.is_defined())
+ stats.priority = *rtcStats.priority;
+ if (rtcStats.url.is_defined())
+ stats.url = ""
+ if (rtcStats.deleted.is_defined())
+ stats.deleted = *rtcStats.deleted;
+}
+
static inline void fillRTCCertificateStats(RTCStatsReport::CertificateStats& stats, const webrtc::RTCCertificateStats& rtcStats)
{
fillRTCStats(stats, rtcStats);
@@ -340,6 +385,10 @@
RTCStatsReport::IceCandidatePairStats stats;
fillRTCIceCandidatePairStats(stats, static_cast<const webrtc::RTCIceCandidatePairStats&>(rtcStats));
report->addStats<IDLDictionary<RTCStatsReport::IceCandidatePairStats>>(WTFMove(stats));
+ } else if (rtcStats.type() == webrtc::RTCRemoteIceCandidateStats::kType || rtcStats.type() == webrtc::RTCLocalIceCandidateStats::kType) {
+ RTCStatsReport::IceCandidateStats stats;
+ fillRTCIceCandidateStats(stats, static_cast<const webrtc::RTCIceCandidateStats&>(rtcStats));
+ report->addStats<IDLDictionary<RTCStatsReport::IceCandidateStats>>(WTFMove(stats));
} else if (rtcStats.type() == webrtc::RTCCertificateStats::kType) {
RTCStatsReport::CertificateStats stats;
fillRTCCertificateStats(stats, static_cast<const webrtc::RTCCertificateStats&>(rtcStats));