test_peerConnection_videoRenegotiationInactiveAnswer.html (3012B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="pc.js"></script> 5 <script type="application/javascript" src="sdpUtils.js"></script> 6 <script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script> 7 </head> 8 <body> 9 <pre id="test"> 10 <script type="application/javascript"> 11 createHTML({ 12 bug: "1213773", 13 title: "Renegotiation: answerer uses a=inactive for video" 14 }); 15 16 runNetworkTest(async (options) => { 17 // [TODO] re-enable HW decoder after bug 1526207 is fixed. 18 if (navigator.userAgent.includes("Android")) { 19 await pushPrefs(["media.navigator.mediadatadecoder_vpx_enabled", false], 20 ["media.webrtc.hw.h264.enabled", false]); 21 } 22 23 const emitter = new VideoFrameEmitter(); 24 const helper = new VideoStreamHelper(); 25 26 const test = new PeerConnectionTest(options); 27 28 test.chain.replace("PC_LOCAL_GUM", [ 29 function PC_LOCAL_CANVAS_CAPTURESTREAM(test) { 30 test.pcLocal.attachLocalStream(emitter.stream()); 31 emitter.start(); 32 } 33 ]); 34 35 var haveFirstUnmuteEvent; 36 37 test.chain.insertBefore("PC_REMOTE_SET_LOCAL_DESCRIPTION", [ 38 function PC_REMOTE_SETUP_ONUNMUTE_1() { 39 haveFirstUnmuteEvent = haveEvent(test.pcRemote._pc.getReceivers()[0].track, "unmute"); 40 } 41 ]); 42 43 test.chain.append([ 44 function PC_REMOTE_CHECK_VIDEO_UNMUTED() { 45 return haveFirstUnmuteEvent; 46 }, 47 function PC_REMOTE_WAIT_FOR_FRAMES() { 48 var vremote = test.pcRemote.remoteMediaElements[0]; 49 ok(vremote, "Should have remote video element for pcRemote"); 50 return addFinallyToPromise(helper.checkVideoPlaying(vremote)) 51 .finally(() => emitter.stop()); 52 } 53 ]); 54 55 addRenegotiation(test.chain, []); 56 57 test.chain.insertAfter("PC_LOCAL_GET_ANSWER", [ 58 function PC_LOCAL_REWRITE_REMOTE_SDP_INACTIVE(test) { 59 test._remote_answer.sdp = 60 sdputils.setAllMsectionsInactive(test._remote_answer.sdp); 61 } 62 ], false, 1); 63 64 test.chain.append([ 65 function PC_REMOTE_ENSURE_NO_FRAMES() { 66 var vremote = test.pcRemote.remoteMediaElements[0]; 67 ok(vremote, "Should have remote video element for pcRemote"); 68 emitter.start(); 69 return addFinallyToPromise(helper.checkVideoPaused(vremote)) 70 .finally(() => emitter.stop()); 71 }, 72 ]); 73 74 test.chain.remove("PC_REMOTE_CHECK_STATS", 1); 75 test.chain.remove("PC_LOCAL_CHECK_STATS", 1); 76 77 addRenegotiation(test.chain, []); 78 79 test.chain.append([ 80 function PC_REMOTE_WAIT_FOR_FRAMES_2() { 81 var vremote = test.pcRemote.remoteMediaElements[0]; 82 ok(vremote, "Should have remote video element for pcRemote"); 83 emitter.start(); 84 return addFinallyToPromise(helper.checkVideoPlaying(vremote)) 85 .finally(() => emitter.stop()); 86 } 87 ]); 88 89 test.setMediaConstraints([{video: true}], []); 90 await test.run(); 91 }); 92 </script> 93 </pre> 94 </body> 95 </html>