RTCPeerConnection-insertable-streams-errors.https.html (1577B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>RTCPeerConnection Insertable Streams - Errors</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src=/resources/testdriver.js></script> 8 <script src=/resources/testdriver-vendor.js></script> 9 <script src='../../mediacapture-streams/permission-helper.js'></script> 10 <script src="../../webrtc/RTCPeerConnection-helper.js"></script> 11 <script src="./RTCPeerConnection-insertable-streams.js"></script> 12 </head> 13 <body> 14 <script> 15 promise_test(async t => { 16 const caller = new RTCPeerConnection({encodedInsertableStreams:true}); 17 t.add_cleanup(() => caller.close()); 18 const callee = new RTCPeerConnection(); 19 t.add_cleanup(() => callee.close()); 20 21 const stream = await navigator.mediaDevices.getUserMedia({video:true}); 22 const track = stream.getTracks()[0]; 23 t.add_cleanup(() => track.stop()); 24 25 const sender = caller.addTrack(track) 26 const streams = sender.createEncodedStreams(); 27 const transformer = new TransformStream({ 28 transform(frame, controller) { 29 // Inserting the same frame twice will result in failure since the frame 30 // will be neutered after the first insertion is processed. 31 controller.enqueue(frame); 32 controller.enqueue(frame); 33 } 34 }); 35 36 exchangeIceCandidates(caller, callee); 37 await exchangeOfferAnswer(caller, callee); 38 39 await promise_rejects_dom( 40 t, 'OperationError', 41 streams.readable.pipeThrough(transformer).pipeTo(streams.writable)); 42 }, 'Enqueuing the same frame twice fails'); 43 44 </script> 45 </body> 46 </html>