diff --git a/webrtc/simulcast/basic.https.html b/webrtc/simulcast/basic.https.html index f7b9def7622f8f..46c0969a405b5e 100644 --- a/webrtc/simulcast/basic.https.html +++ b/webrtc/simulcast/basic.https.html @@ -18,6 +18,6 @@ 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'); diff --git a/webrtc/simulcast/getStats.https.html b/webrtc/simulcast/getStats.https.html index b5a9e6eb28307c..91d9ab00d874df 100644 --- a/webrtc/simulcast/getStats.https.html +++ b/webrtc/simulcast/getStats.https.html @@ -18,7 +18,7 @@ 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(); diff --git a/webrtc/simulcast/h264.https.html b/webrtc/simulcast/h264.https.html index 038449aa6e7fe7..2d27b963a69ee4 100644 --- a/webrtc/simulcast/h264.https.html +++ b/webrtc/simulcast/h264.https.html @@ -26,6 +26,7 @@ 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'); diff --git a/webrtc/simulcast/screenshare.https.html b/webrtc/simulcast/screenshare.https.html new file mode 100644 index 00000000000000..5a40d8cba48dec --- /dev/null +++ b/webrtc/simulcast/screenshare.https.html @@ -0,0 +1,28 @@ + + +RTCPeerConnection Screen-sharing Simulcast Tests + + + + + + + + + diff --git a/webrtc/simulcast/setParameters-active.https.html b/webrtc/simulcast/setParameters-active.https.html index 54191059a0628a..894014b1912a0c 100644 --- a/webrtc/simulcast/setParameters-active.https.html +++ b/webrtc/simulcast/setParameters-active.https.html @@ -33,7 +33,7 @@ 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 @@ 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 @@ 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(); diff --git a/webrtc/simulcast/simulcast.js b/webrtc/simulcast/simulcast.js index e0b90d8ac37bff..4d0da093f453a0 100644 --- a/webrtc/simulcast/simulcast.js +++ b/webrtc/simulcast/simulcast.js @@ -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; +} diff --git a/webrtc/simulcast/vp8.https.html b/webrtc/simulcast/vp8.https.html index 3d04bc71726e71..9e0a8085df21ed 100644 --- a/webrtc/simulcast/vp8.https.html +++ b/webrtc/simulcast/vp8.https.html @@ -21,6 +21,7 @@ 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'); diff --git a/webrtc/simulcast/vp9-scalability-mode.https.html b/webrtc/simulcast/vp9-scalability-mode.https.html index 8d8f974fcdcb6e..1c2d48c5dc417b 100644 --- a/webrtc/simulcast/vp9-scalability-mode.https.html +++ b/webrtc/simulcast/vp9-scalability-mode.https.html @@ -23,13 +23,14 @@ // 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'); diff --git a/webrtc/simulcast/vp9.https.html b/webrtc/simulcast/vp9.https.html index a033dab4779684..d366120b6e84b9 100644 --- a/webrtc/simulcast/vp9.https.html +++ b/webrtc/simulcast/vp9.https.html @@ -21,6 +21,7 @@ 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');