test_peerConnection_stats_jitter.html (1647B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="pc.js"></script> 5 <script type="application/javascript" src="stats.js"></script> 6 </head> 7 <body> 8 <pre id="test"> 9 <script type="application/javascript"> 10 createHTML({ 11 bug: "1672590", 12 title: "Jitter sanity check" 13 }); 14 15 const checkJitter = stats => { 16 stats.forEach((stat, mapKey) => { 17 if (stat.type == "remote-inbound-rtp") { 18 // This should be much lower for audio, TODO: Bug 1330575 19 const expectedJitter = stat.kind == "video" ? 0.5 : 1; 20 21 ok(stat.jitter < expectedJitter, 22 stat.type + ".jitter is sane number for a local only test. value=" 23 + stat.jitter); 24 } 25 }); 26 }; 27 28 const PC_LOCAL_TEST_LOCAL_JITTER = async test => { 29 checkJitter(await waitForSyncedRtcp(test.pcLocal._pc)); 30 } 31 32 const PC_REMOTE_TEST_REMOTE_JITTER = async test => { 33 checkJitter(await waitForSyncedRtcp(test.pcRemote._pc)); 34 } 35 36 runNetworkTest(async function (options) { 37 // We don't know how to get QP value when using Android system codecs. 38 if (navigator.userAgent.includes("Android")) { 39 await pushPrefs(["media.navigator.mediadatadecoder_vpx_enabled", false], 40 ["media.webrtc.hw.h264.enabled", false]); 41 } 42 43 const test = new PeerConnectionTest(options); 44 45 test.chain.insertAfter("PC_LOCAL_WAIT_FOR_MEDIA_FLOW", 46 [PC_LOCAL_TEST_LOCAL_JITTER]); 47 48 test.chain.insertAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW", 49 [PC_REMOTE_TEST_REMOTE_JITTER]); 50 51 test.setMediaConstraints([{audio: true}, {video: true}], 52 [{audio: true}, {video: true}]); 53 await test.run(); 54 }); 55 </script> 56 </pre> 57 </body> 58 </html>