tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_peerConnection_setParameters_maxFramerate_oldSetParameters.html (1715B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <script type="application/javascript" src="pc.js"></script>
      5 </head>
      6 <body>
      7 <pre id="test">
      8 <script type="application/javascript">
      9 createHTML({
     10  bug: "1611957",
     11  title: "Live-updating maxFramerate"
     12 });
     13 
     14 let sender, receiver;
     15 
     16 async function checkMaxFrameRate(rate) {
     17  sender.setParameters({ encodings: [{ maxFramerate: rate }] });
     18  await wait(2000);
     19  const stats = Array.from((await receiver.getStats()).values());
     20  const inboundRtp = stats.find(stat => stat.type == "inbound-rtp");
     21  info(`inbound-rtp stats: ${JSON.stringify(inboundRtp)}`);
     22  const fps = inboundRtp.framesPerSecond;
     23  ok(fps <= (rate * 1.1) + 1, `fps is an appropriate value (${fps}) for rate (${rate})`);
     24 }
     25 
     26 runNetworkTest(async function (options) {
     27  let test = new PeerConnectionTest(options);
     28  test.setMediaConstraints([{video: true}], []);
     29  test.chain.append([
     30    function CHECK_PRECONDITIONS() {
     31      is(test.pcLocal._pc.getSenders().length, 1,
     32          "Should have 1 local sender");
     33      is(test.pcRemote._pc.getReceivers().length, 1,
     34          "Should have 1 remote receiver");
     35 
     36      sender = test.pcLocal._pc.getSenders()[0];
     37      receiver = test.pcRemote._pc.getReceivers()[0];
     38    },
     39    function PC_LOCAL_SET_MAX_FRAMERATE_2() {
     40      return checkMaxFrameRate(2);
     41    },
     42    function PC_LOCAL_SET_MAX_FRAMERATE_4() {
     43      return checkMaxFrameRate(4);
     44    },
     45    function PC_LOCAL_SET_MAX_FRAMERATE_15() {
     46      return checkMaxFrameRate(15);
     47    },
     48    function PC_LOCAL_SET_MAX_FRAMERATE_8() {
     49      return checkMaxFrameRate(8);
     50    },
     51    function PC_LOCAL_SET_MAX_FRAMERATE_1() {
     52      return checkMaxFrameRate(1);
     53    },
     54  ]);
     55  await test.run();
     56 });
     57 </script>
     58 </pre>
     59 </body>
     60 </html>