Bug 1692873 - Test simulcast screenshare in webrtc/simulcast/screenshare.https.html WPT. r=bwc

Depends on D189663

Differential Revision: https://phabricator.services.mozilla.com/D189677
This commit is contained in:
Jan-Ivar Bruaroey 2024-11-19 15:25:19 +00:00
parent ee87fedde5
commit ed55ce1239
10 changed files with 61 additions and 15 deletions

View File

@ -0,0 +1,10 @@
[basic.https.html]
expected:
if (os == "win") and not swgl and not debug and (processor == "x86"): [OK, TIMEOUT]
if (os == "linux") and not debug: [OK, TIMEOUT]
if (os == "win") and swgl: [OK, TIMEOUT]
[Basic simulcast setup with two spatial layers]
expected:
if (os == "win") and not swgl and not debug and (processor == "x86"): [PASS, TIMEOUT]
if (os == "linux") and not debug: [PASS, TIMEOUT]
if (os == "win") and swgl: [PASS, TIMEOUT]

View File

@ -18,6 +18,6 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
return negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2);
await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2);
}, 'Basic simulcast setup with two spatial layers');
</script>

View File

@ -18,7 +18,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2);
await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2);
const outboundStats = [];
const senderStats = await pc1.getSenders()[0].getStats();

View File

@ -26,6 +26,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
return negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2, {mimeType: 'video/H264'});
await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2,
{mimeType: 'video/H264'});
}, 'H264 simulcast setup with two streams');
</script>

View File

@ -0,0 +1,28 @@
<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection Screen-sharing Simulcast Tests</title>
<meta name="timeout" content="long">
<script src="../third_party/sdp/sdp.js"></script>
<script src="simulcast.js"></script>
<script src="../RTCPeerConnection-helper.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
promise_test(async t => {
// Test getDisplayMedia with simulcast
await test_driver.bless('getDisplayMedia');
const stream = await navigator.mediaDevices.getDisplayMedia({
video: {width: 1280, height: 720}
});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const rids = [0, 1];
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
return negotiateSimulcastAndWaitForVideo(t, stream, rids, pc1, pc2);
}, 'Basic simulcast setup with two spatial layers');
</script>

View File

@ -33,7 +33,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2);
await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2);
// Deactivate first sender.
const parameters = pc1.getSenders()[0].getParameters();
@ -58,7 +58,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2);
await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2);
// Deactivate second sender.
const parameters = pc1.getSenders()[0].getParameters();
@ -83,7 +83,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2);
await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2);
// Deactivate all senders.
const parameters = pc1.getSenders()[0].getParameters();

View File

@ -220,7 +220,7 @@ function swapRidAndMidExtensionsInSimulcastAnswer(answer, localDescription, rids
}
async function negotiateSimulcastAndWaitForVideo(
t, rids, pc1, pc2, codec, scalabilityMode = undefined) {
t, stream, rids, pc1, pc2, codec, scalabilityMode = undefined) {
exchangeIceCandidates(pc1, pc2);
const metadataToBeLoaded = [];
@ -251,10 +251,6 @@ async function negotiateSimulcastAndWaitForVideo(
scaleResolutionDownBy *= 2;
}
// Use getUserMedia as getNoiseStream does not have enough entropy to ramp-up.
await setMediaPermission();
const stream = await navigator.mediaDevices.getUserMedia({video: {width: 1280, height: 720}});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
const transceiver = pc1.addTransceiver(stream.getVideoTracks()[0], {
streams: [stream],
sendEncodings: sendEncodings,
@ -278,3 +274,11 @@ async function negotiateSimulcastAndWaitForVideo(
assert_equals(metadataToBeLoaded.length, rids.length);
return Promise.all(metadataToBeLoaded);
}
async function getCameraStream(t) {
// Use getUserMedia as getNoiseStream does not have enough entropy to ramp-up.
await setMediaPermission();
const stream = await navigator.mediaDevices.getUserMedia({video: {width: 1280, height: 720}});
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop()));
return stream;
}

View File

@ -21,6 +21,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
return negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2, {mimeType: 'video/VP8'});
return negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2,
{mimeType: 'video/VP8'});
}, 'VP8 simulcast setup with two streams');
</script>

View File

@ -23,13 +23,14 @@ promise_test(async t => {
// This is not a scalability mode test (see wpt/webrtc-svc/ for those) but a
// VP9 simulcast test. Setting `scalabilityMode` should not be needed, however
// many browsers interprets multiple VP9 encodings to mean multiple spatial
// some browsers interpret multiple VP9 encodings to mean multiple spatial
// layers by default. During a transition period, Chromium-based browsers
// requires explicitly specifying the scalability mode as a way to opt-in to
// spec-compliant simulcast. See also wpt/webrtc/simulcast/vp9.https.html for
// a version of this test that does not set the scalability mode.
const scalabilityMode = 'L1T2';
return negotiateSimulcastAndWaitForVideo(
t, rids, pc1, pc2, {mimeType: 'video/VP9'}, scalabilityMode);
t, await getCameraStream(t), rids, pc1, pc2, {mimeType: 'video/VP9'},
scalabilityMode);
}, 'VP9 simulcast setup with two streams and L1T2 set');
</script>

View File

@ -21,6 +21,7 @@ promise_test(async t => {
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
return negotiateSimulcastAndWaitForVideo(t, rids, pc1, pc2, {mimeType: 'video/VP9'});
return negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2,
{mimeType: 'video/VP9'});
}, 'VP9 simulcast setup with two streams');
</script>