Bug 1882399 - Avoid warnings (or turn off media.peerconnection.treat_warnings_as_errors on legacy tests). r=bwc

Differential Revision: https://phabricator.services.mozilla.com/D203815
This commit is contained in:
Jan-Ivar Bruaroey 2024-03-08 20:58:07 +00:00
parent 153a3a5c99
commit 765e428d7a
11 changed files with 48 additions and 21 deletions

View File

@ -24,6 +24,8 @@ if (!("mediaDevices" in navigator)) {
['media.peerconnection.nat_simulator.filtering_type', 'PORT_DEPENDENT'], ['media.peerconnection.nat_simulator.filtering_type', 'PORT_DEPENDENT'],
['media.peerconnection.nat_simulator.mapping_type', 'PORT_DEPENDENT'], ['media.peerconnection.nat_simulator.mapping_type', 'PORT_DEPENDENT'],
['media.peerconnection.nat_simulator.block_tcp', true], ['media.peerconnection.nat_simulator.block_tcp', true],
// The above triggers warning about 5 ICE servers
['media.peerconnection.treat_warnings_as_errors', false],
['media.getusermedia.insecure.enabled', true]); ['media.getusermedia.insecure.enabled', true]);
options.expectedLocalCandidateType = "srflx"; options.expectedLocalCandidateType = "srflx";
options.expectedRemoteCandidateType = "relay"; options.expectedRemoteCandidateType = "relay";

View File

@ -26,6 +26,8 @@ if (!("mediaDevices" in navigator)) {
['media.peerconnection.nat_simulator.block_tcp', false], ['media.peerconnection.nat_simulator.block_tcp', false],
['media.peerconnection.nat_simulator.block_tls', true], ['media.peerconnection.nat_simulator.block_tls', true],
['media.peerconnection.ice.loopback', true], ['media.peerconnection.ice.loopback', true],
// The above sets up 5+ ICE servers which triggers a warning
['media.peerconnection.treat_warnings_as_errors', false],
['media.getusermedia.insecure.enabled', true]); ['media.getusermedia.insecure.enabled', true]);
options.expectedLocalCandidateType = "relay-tcp"; options.expectedLocalCandidateType = "relay-tcp";
options.expectedRemoteCandidateType = "relay-tcp"; options.expectedRemoteCandidateType = "relay-tcp";

View File

@ -25,6 +25,8 @@ if (!("mediaDevices" in navigator)) {
['media.peerconnection.nat_simulator.block_udp', true], ['media.peerconnection.nat_simulator.block_udp', true],
['media.peerconnection.nat_simulator.block_tcp', true], ['media.peerconnection.nat_simulator.block_tcp', true],
['media.peerconnection.ice.loopback', true], ['media.peerconnection.ice.loopback', true],
// The above triggers warning about 5 ICE servers
['media.peerconnection.treat_warnings_as_errors', false],
['media.getusermedia.insecure.enabled', true]); ['media.getusermedia.insecure.enabled', true]);
options.expectedLocalCandidateType = "relay-tls"; options.expectedLocalCandidateType = "relay-tls";
options.expectedRemoteCandidateType = "relay-tls"; options.expectedRemoteCandidateType = "relay-tls";

View File

@ -24,6 +24,8 @@ if (!("mediaDevices" in navigator)) {
['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'], ['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'],
['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT'], ['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT'],
['media.peerconnection.nat_simulator.block_tcp', true], ['media.peerconnection.nat_simulator.block_tcp', true],
// The above triggers warning about 5 ICE servers
['media.peerconnection.treat_warnings_as_errors', false],
['media.getusermedia.insecure.enabled', true]); ['media.getusermedia.insecure.enabled', true]);
options.expectedLocalCandidateType = "srflx"; options.expectedLocalCandidateType = "srflx";
options.expectedRemoteCandidateType = "srflx"; options.expectedRemoteCandidateType = "srflx";

View File

@ -25,6 +25,8 @@ if (!("mediaDevices" in navigator)) {
['media.peerconnection.nat_simulator.block_udp', true], ['media.peerconnection.nat_simulator.block_udp', true],
['media.peerconnection.nat_simulator.error_code_for_drop', 3 /*R_INTERNAL*/], ['media.peerconnection.nat_simulator.error_code_for_drop', 3 /*R_INTERNAL*/],
['media.peerconnection.nat_simulator.block_tls', true], ['media.peerconnection.nat_simulator.block_tls', true],
// The above triggers warning about 5 ICE servers
['media.peerconnection.treat_warnings_as_errors', false],
['media.getusermedia.insecure.enabled', true]); ['media.getusermedia.insecure.enabled', true]);
options.expectedLocalCandidateType = "relay-tcp"; options.expectedLocalCandidateType = "relay-tcp";
options.expectedRemoteCandidateType = "relay-tcp"; options.expectedRemoteCandidateType = "relay-tcp";

View File

@ -14,7 +14,10 @@ createHTML({
runNetworkTest(async () => { runNetworkTest(async () => {
await pushPrefs( await pushPrefs(
// Enable mDNS, since there are some checks we want to run with that // Enable mDNS, since there are some checks we want to run with that
['media.peerconnection.ice.obfuscate_host_addresses', true]); ['media.peerconnection.ice.obfuscate_host_addresses', true],
// The above triggers warning about 5 ICE servers
['media.peerconnection.treat_warnings_as_errors', false],
);
const offerer = new RTCPeerConnection({iceServers: iceServersArray, iceTransportPolicy: 'relay'}); const offerer = new RTCPeerConnection({iceServers: iceServersArray, iceTransportPolicy: 'relay'});
const answerer = new RTCPeerConnection({iceServers: iceServersArray}); const answerer = new RTCPeerConnection({iceServers: iceServersArray});

View File

@ -1,4 +1,4 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<script type="application/javascript" src="pc.js"></script> <script type="application/javascript" src="pc.js"></script>
@ -50,22 +50,27 @@ pc2.onicecandidate = e => {
.catch(generateErrorCallback()); .catch(generateErrorCallback());
}; };
var v1, v2; runNetworkTest(async function() {
var delivered = new Promise(resolve => { // Tests trigger warnings
pc2.onaddstream = e => { await SpecialPowers.pushPrefEnv({
v2.srcObject = e.stream; set: [['media.peerconnection.treat_warnings_as_errors', false]]
resolve(e.stream); });
};
}); const v1 = createMediaElement('video', 'v1');
const v2 = createMediaElement('video', 'v2');
const delivered = new Promise(resolve => {
pc2.onaddstream = e => {
v2.srcObject = e.stream;
resolve(e.stream);
};
});
runNetworkTest(function() {
v1 = createMediaElement('video', 'v1');
v2 = createMediaElement('video', 'v2');
var canPlayThrough = new Promise(resolve => v2.canplaythrough = resolve); var canPlayThrough = new Promise(resolve => v2.canplaythrough = resolve);
is(v2.currentTime, 0, "v2.currentTime is zero at outset"); is(v2.currentTime, 0, "v2.currentTime is zero at outset");
// not testing legacy gUM here // not testing legacy gUM here
return navigator.mediaDevices.getUserMedia({ video: true, audio: true }) await navigator.mediaDevices.getUserMedia({ video: true, audio: true })
.then(stream => pc1.addStream(v1.srcObject = stream)) .then(stream => pc1.addStream(v1.srcObject = stream))
.then(() => pcall(pc1, pc1.createOffer)) .then(() => pcall(pc1, pc1.createOffer))
.then(offer => pcall(pc1, pc1.setLocalDescription, offer)) .then(offer => pcall(pc1, pc1.setLocalDescription, offer))

View File

@ -46,10 +46,14 @@ runNetworkTest(() => {
{ urls:"turn:[::1]:5349", username:"p", credential:"p" }, { urls:"turn:[::1]:5349", username:"p", credential:"p" },
{ urls:"turn:[::1]:3478", username:"p", credential:"p" }, { urls:"turn:[::1]:3478", username:"p", credential:"p" },
{ urls:"turn:[::1]", username:"p", credential:"p" }, { urls:"turn:[::1]", username:"p", credential:"p" },
]});
makePC({ iceServers: [
{ urls:"turn:localhost:53?transport=udp", username:"p", credential:"p" }, { urls:"turn:localhost:53?transport=udp", username:"p", credential:"p" },
{ urls:"turn:localhost:3478?transport=udp", username:"p", credential:"p" }, { urls:"turn:localhost:3478?transport=udp", username:"p", credential:"p" },
{ urls:"turn:localhost:53?transport=tcp", username:"p", credential:"p" }, { urls:"turn:localhost:53?transport=tcp", username:"p", credential:"p" },
{ urls:"turn:localhost:3478?transport=tcp", username:"p", credential:"p" }, { urls:"turn:localhost:3478?transport=tcp", username:"p", credential:"p" },
]});
makePC({ iceServers: [
{ urls:"turns:localhost:3478?transport=udp", username:"p", credential:"p" }, { urls:"turns:localhost:3478?transport=udp", username:"p", credential:"p" },
{ urls:"stun:localhost", foo:"" } { urls:"stun:localhost", foo:"" }
]}); ]});

View File

@ -15,12 +15,12 @@
visible: true visible: true
}); });
function makeCodecTopPriority(sdp, codec) { function makeCodecTopPriority({type, sdp}, codec) {
const ptToMove = sdputils.findCodecId(sdp, codec); const ptToMove = sdputils.findCodecId(sdp, codec);
return sdp.replace( return {type, sdp: sdp.replace(
// m=video port type pts ptToMove more-pts? // m=video port type pts ptToMove more-pts?
new RegExp(`(m=video [^ ]+ [^ ]+)(.*)( ${ptToMove})( [^ ]+)?`, "g"), new RegExp(`(m=video [^ ]+ [^ ]+)(.*)( ${ptToMove})( [^ ]+)?`, "g"),
'$1$3$2$4'); '$1$3$2$4')};
} }
function isCodecFirst(sdp, codec) { function isCodecFirst(sdp, codec) {
@ -34,8 +34,7 @@
const stream = await navigator.mediaDevices.getUserMedia({ video: true }); const stream = await navigator.mediaDevices.getUserMedia({ video: true });
const sender = pc1.addTrack(stream.getTracks()[0]); const sender = pc1.addTrack(stream.getTracks()[0]);
await pc1.setLocalDescription(); await pc1.setLocalDescription();
let mungedOffer = pc1.localDescription; const mungedOffer = makeCodecTopPriority(pc1.localDescription, codec);
mungedOffer.sdp = makeCodecTopPriority(mungedOffer.sdp, codec);
await pc2.setRemoteDescription(mungedOffer); await pc2.setRemoteDescription(mungedOffer);
await pc2.setLocalDescription(); await pc2.setLocalDescription();
await pc1.setRemoteDescription(pc2.localDescription); await pc1.setRemoteDescription(pc2.localDescription);
@ -51,8 +50,7 @@
await pc1.setLocalDescription(); await pc1.setLocalDescription();
await pc2.setRemoteDescription(pc1.localDescription); await pc2.setRemoteDescription(pc1.localDescription);
await pc2.setLocalDescription(); await pc2.setLocalDescription();
let mungedAnswer = pc2.localDescription; const mungedAnswer = makeCodecTopPriority(pc2.localDescription, codec);
mungedAnswer.sdp = makeCodecTopPriority(mungedAnswer.sdp, codec);
await pc1.setRemoteDescription(mungedAnswer); await pc1.setRemoteDescription(mungedAnswer);
is(isCodecFirst((await pc1.createOffer()).sdp, codec), !isPseudoCodec, is(isCodecFirst((await pc1.createOffer()).sdp, codec), !isPseudoCodec,
"Top-priority codecs should come first in reoffers, unless they are pseudo codecs (eg; ulpfec)"); "Top-priority codecs should come first in reoffers, unless they are pseudo codecs (eg; ulpfec)");

View File

@ -23,6 +23,8 @@ if (!("mediaDevices" in navigator)) {
await pushPrefs( await pushPrefs(
['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'], ['media.peerconnection.nat_simulator.filtering_type', 'ENDPOINT_INDEPENDENT'],
['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT'], ['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT'],
// The above triggers warning about 5 ICE servers
['media.peerconnection.treat_warnings_as_errors', false],
['media.getusermedia.insecure.enabled', true]); ['media.getusermedia.insecure.enabled', true]);
const test = new PeerConnectionTest(options); const test = new PeerConnectionTest(options);
makeOffererNonTrickle(test.chain); makeOffererNonTrickle(test.chain);

View File

@ -11,7 +11,12 @@
title: "Throw in PeerConnection callbacks" title: "Throw in PeerConnection callbacks"
}); });
runNetworkTest(function () { runNetworkTest(async function () {
// Tests trigger warnings
await SpecialPowers.pushPrefEnv({
set: [['media.peerconnection.treat_warnings_as_errors', false]]
});
let finish; let finish;
const onfinished = new Promise(r => finish = async () => { const onfinished = new Promise(r => finish = async () => {
window.onerror = oldOnError; window.onerror = oldOnError;