rid-manipulation.html (1683B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>RTCPeerConnection Simulcast Tests - RID manipulation</title> 4 <meta name="timeout" content="long"> 5 <script src="../third_party/sdp/sdp.js"></script> 6 <script src="simulcast.js"></script> 7 <script src="../RTCPeerConnection-helper.js"></script> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/resources/testdriver.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <script src="../../mediacapture-streams/permission-helper.js"></script> 13 <script> 14 15 promise_test(async t => { 16 const pc1 = new RTCPeerConnection(); 17 const pc2 = new RTCPeerConnection(); 18 t.add_cleanup(() => pc1.close()); 19 t.add_cleanup(() => pc2.close()); 20 const rids = [0, 1, 2]; 21 pc1.addTransceiver("video", {sendEncodings: rids.map(rid => ({rid}))}); 22 const [{sender}] = pc1.getTransceivers(); 23 24 const negotiateSfuAnswer = async asimulcast => { 25 const offer = await pc1.createOffer(); 26 await pc1.setLocalDescription(offer); 27 offer.sdp = swapRidAndMidExtensionsInSimulcastOffer(offer, rids); 28 await pc2.setRemoteDescription(offer); 29 const answer = await pc2.createAnswer(); 30 await pc2.setLocalDescription(answer); 31 answer.sdp = swapRidAndMidExtensionsInSimulcastAnswer(answer,pc1.localDescription, rids); 32 answer.sdp = answer.sdp.replace('a=simulcast:recv 0;1;2', asimulcast); 33 return answer; 34 }; 35 await pc1.setRemoteDescription(await negotiateSfuAnswer('a=simulcast:recv foo;1;2')); 36 await pc1.setRemoteDescription(await negotiateSfuAnswer('a=simulcast:recv foo;bar;2')); 37 }, 'Remote reanswer altering rids does not throw an exception.'); 38 39 </script>