tor-browser

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

simulcast-offer.html (1264B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCPeerConnection Simulcast Offer</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script>
      7 'use strict';
      8 
      9 // Tests for the construction of offers with simulcast according to:
     10 // draft-ietf-mmusic-sdp-simulcast-13
     11 // draft-ietf-mmusic-rid-15
     12 promise_test(async t => {
     13  const pc = new RTCPeerConnection();
     14  t.add_cleanup(() => pc.close());
     15  const expected_rids = ['foo', 'bar', 'baz'];
     16  pc.addTransceiver('video', {
     17    sendEncodings: expected_rids.map(rid => ({rid}))
     18  });
     19 
     20  const offer = await pc.createOffer();
     21  let offer_lines = offer.sdp.split('\r\n');
     22  // Check for a RID line for each layer.
     23  for (const rid of expected_rids) {
     24    let result = offer_lines.find(line => line.startsWith(`a=rid:${rid}`));
     25    assert_not_equals(result, undefined, `RID attribute for '${rid}' missing.`);
     26  }
     27 
     28  // Check for simulcast attribute with send direction and all RIDs.
     29  let result = offer_lines.find(
     30      line => line.startsWith(`a=simulcast:send ${expected_rids.join(';')}`));
     31  assert_not_equals(result, undefined, "Could not find simulcast attribute.");
     32 }, 'createOffer() with multiple send encodings should create simulcast offer');
     33 </script>