mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1435789: implement relayProtocol for localcandidate stats r=smaug,ng
relayProtocol is the standardized variant of mozLocalTransport. Spec: https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatestats-relayprotocol IDL: https://w3c.github.io/webrtc-stats/#icecandidate-dict* Differential Revision: https://phabricator.services.mozilla.com/D3428 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
96bd865e6d
commit
c0cf9f10eb
@ -347,6 +347,8 @@ skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emula
|
||||
[test_peerConnection_bug1227781.html]
|
||||
[test_peerConnection_stats.html]
|
||||
skip-if = toolkit == 'android' # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858)
|
||||
[test_peerConnection_stats_relayProtocol.html]
|
||||
skip-if = toolkit == 'android' # android(Bug 1189784, timeouts on 4.3 emulator, Bug 1373858)
|
||||
[test_peerConnection_sender_and_receiver_stats.html]
|
||||
skip-if = (android_version == '18') # android(Bug 1189784, timeouts on 4.3 emulator)
|
||||
[test_peerConnection_trackless_sender_stats.html]
|
||||
|
@ -581,9 +581,8 @@ var PC_REMOTE_TEST_REMOTE_STATS = test => {
|
||||
});
|
||||
}
|
||||
|
||||
var test;
|
||||
runNetworkTest(function (options) {
|
||||
test = new PeerConnectionTest(options);
|
||||
const test = new PeerConnectionTest(options);
|
||||
|
||||
test.chain.insertAfter("PC_LOCAL_WAIT_FOR_MEDIA_FLOW",
|
||||
[PC_LOCAL_TEST_LOCAL_STATS]);
|
||||
|
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script type="application/javascript" src="nonTrickleIce.js"></script>
|
||||
<script type="application/javascript" src="pc.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
createHTML({
|
||||
bug: "1435789",
|
||||
title: "WebRTC local-candidate relayProtocol stats attribute"
|
||||
});
|
||||
var PC_LOCAL_TEST_LOCAL_STATS_RELAYCANDIDATE = test => {
|
||||
return test.pcLocal.getStats().then(stats => {
|
||||
let haveRelayProtocol = {};
|
||||
for (let [k, v] of stats) {
|
||||
if (v.type == "local-candidate") {
|
||||
haveRelayProtocol[v.candidateType + "-" + v.relayProtocol] = v.relayProtocol;
|
||||
}
|
||||
}
|
||||
is(haveRelayProtocol["host-undefined"], undefined, "relayProtocol not set for host candidates");
|
||||
is(haveRelayProtocol["serverreflexive-undefined"], undefined, "relayProtocol not set for serverreflexive candidates");
|
||||
ok(haveRelayProtocol["relayed-udp"], "Has UDP relay candidate");
|
||||
ok(haveRelayProtocol["relayed-tcp"], "Has TCP relay candidate");
|
||||
// TURN/TLS does not work, see https://bugzilla.mozilla.org/show_bug.cgi?id=1323439
|
||||
// With TURN/TLS working, we should have exactly five entries in haveRelayProtocol.
|
||||
todo(haveRelayProtocol["relayed-tls"], "Has TLS relay candidate. See https://bugzilla.mozilla.org/show_bug.cgi?id=1323439");
|
||||
is(Object.keys(haveRelayProtocol).length, 4, "All candidate types are accounted for");
|
||||
});
|
||||
}
|
||||
|
||||
runNetworkTest(options => {
|
||||
// uses NAT simulator in order to get srflx candidates.
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{
|
||||
'set': [
|
||||
['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'],
|
||||
['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT']
|
||||
]
|
||||
}, function (options) {
|
||||
const test = new PeerConnectionTest(options);
|
||||
makeOffererNonTrickle(test.chain);
|
||||
makeAnswererNonTrickle(test.chain);
|
||||
|
||||
test.chain.removeAfter("PC_LOCAL_WAIT_FOR_MEDIA_FLOW");
|
||||
test.chain.append([PC_LOCAL_TEST_LOCAL_STATS_RELAYCANDIDATE]);
|
||||
|
||||
test.setMediaConstraints([{ audio: true }], [{ audio: true }]);
|
||||
test.run();
|
||||
})
|
||||
}, { useIceServer: true });
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -228,6 +228,7 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateStats>
|
||||
WriteParam(aMsg, aParam.mComponentId);
|
||||
WriteParam(aMsg, aParam.mIpAddress);
|
||||
WriteParam(aMsg, aParam.mMozLocalTransport);
|
||||
WriteParam(aMsg, aParam.mRelayProtocol);
|
||||
WriteParam(aMsg, aParam.mPortNumber);
|
||||
WriteParam(aMsg, aParam.mTransport);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
@ -240,6 +241,7 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateStats>
|
||||
!ReadParam(aMsg, aIter, &(aResult->mComponentId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mIpAddress)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMozLocalTransport)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRelayProtocol)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPortNumber)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mTransport)) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
|
@ -155,7 +155,8 @@ dictionary RTCIceCandidateStats : RTCStats {
|
||||
DOMString candidateId;
|
||||
DOMString ipAddress;
|
||||
DOMString transport;
|
||||
DOMString mozLocalTransport; // needs standardization
|
||||
DOMString mozLocalTransport; // obsoleted by relayProtocol
|
||||
DOMString relayProtocol;
|
||||
long portNumber;
|
||||
RTCStatsIceCandidateType candidateType;
|
||||
};
|
||||
|
@ -1156,6 +1156,10 @@ static void ToRTCIceCandidateStats(
|
||||
if (candidateType == RTCStatsType::Local_candidate) {
|
||||
cand.mMozLocalTransport.Construct(
|
||||
NS_ConvertASCIItoUTF16(candidate.local_addr.transport.c_str()));
|
||||
if (RTCStatsIceCandidateType(candidate.type) == RTCStatsIceCandidateType::Relayed) {
|
||||
cand.mRelayProtocol.Construct(
|
||||
NS_ConvertASCIItoUTF16(candidate.local_addr.transport.c_str()));
|
||||
}
|
||||
}
|
||||
report->mIceCandidateStats.Value().AppendElement(cand, fallible);
|
||||
if (candidate.trickled) {
|
||||
|
@ -980,9 +980,9 @@ static uint32_t GetCandidateIpAndTransportMask(const RTCIceCandidateStats *cand)
|
||||
uint32_t res = 0;
|
||||
|
||||
nsAutoCString transport;
|
||||
// prefer local transport for local relay candidates
|
||||
if (cand->mMozLocalTransport.WasPassed()) {
|
||||
transport.Assign(NS_ConvertUTF16toUTF8(cand->mMozLocalTransport.Value()));
|
||||
// prefer relay transport for local relay candidates
|
||||
if (cand->mRelayProtocol.WasPassed()) {
|
||||
transport.Assign(NS_ConvertUTF16toUTF8(cand->mRelayProtocol.Value()));
|
||||
} else {
|
||||
transport.Assign(NS_ConvertUTF16toUTF8(cand->mTransport.Value()));
|
||||
}
|
||||
|
@ -850,7 +850,7 @@ ICEStats.prototype = {
|
||||
var type = c.candidateType;
|
||||
|
||||
if (c.type == "local-candidate" && c.candidateType == "relayed") {
|
||||
type = `${c.candidateType}-${c.mozLocalTransport}`;
|
||||
type = `${c.candidateType}-${c.relayProtocol}`;
|
||||
}
|
||||
|
||||
return `${c.ipAddress}:${c.portNumber}/${c.transport}(${type})`;
|
||||
|
Loading…
Reference in New Issue
Block a user