tor-browser

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

test_peerConnection_basicAudioVideoVerifyExtmap.html (3781B)


      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: "1406529",
     11    title: "Verify SDP extmap attribute for sendrecv connection"
     12  });
     13 
     14  var test;
     15  runNetworkTest(async function (options) {
     16    await pushPrefs(["media.navigator.video.use_transport_cc", true]);
     17 
     18    test = new PeerConnectionTest(options);
     19    test.setMediaConstraints([{audio: true}, {video: true}],
     20                             [{audio: true}, {video: true}]);
     21 
     22    test.chain.insertAfter('PC_LOCAL_SET_LOCAL_DESCRIPTION', [
     23      async function PC_LOCAL_CHECK_SDP_OFFER_EXTMAP() {
     24        sdputils.verify_unique_extmap_ids(test.originalOffer.sdp);
     25 
     26        const audio = sdputils.findExtmapIdsUrnsDirections(
     27            sdputils.getAudioMSections(test.originalOffer.sdp));
     28        const expected_audio = [
     29          /* Please modify this list when you add or remove RTP header
     30          extensions. */
     31          ["1", "urn:ietf:params:rtp-hdrext:ssrc-audio-level", ""],
     32          ["2", "urn:ietf:params:rtp-hdrext:csrc-audio-level", "recvonly"],
     33          ["3", "urn:ietf:params:rtp-hdrext:sdes:mid", ""],
     34        ];
     35        // *Ugh* ...
     36        ok(JSON.stringify(audio) ===
     37           JSON.stringify(expected_audio),
     38           "List of offer audio URNs meets expected values");
     39 
     40        const video = sdputils.findExtmapIdsUrnsDirections(
     41            sdputils.getVideoMSections(test.originalOffer.sdp));
     42        const expected_video = [
     43          /* Please modify this list when you add or remove RTP header
     44          extensions. */
     45          ["3", "urn:ietf:params:rtp-hdrext:sdes:mid", ""],
     46          ["4", "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time", ""],
     47          ["5", "urn:ietf:params:rtp-hdrext:toffset", ""],
     48          ["6", "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay", "recvonly"],
     49          ["7", "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01", ""],
     50        ];
     51        // *Ugh* ...
     52        ok(JSON.stringify(video) ===
     53           JSON.stringify(expected_video),
     54           "List of offer video URNs meets expected values");
     55      }
     56    ]);
     57 
     58    test.chain.removeAfter('PC_REMOTE_SET_LOCAL_DESCRIPTION');
     59    test.chain.append([
     60      async function PC_REMOTE_CHECK_SDP_ANSWER_EXTMAP() {
     61        sdputils.verify_unique_extmap_ids(test.originalAnswer.sdp);
     62 
     63        const audio = sdputils.findExtmapIdsUrnsDirections(
     64            sdputils.getAudioMSections(test.originalAnswer.sdp));
     65        const expected_audio = [
     66          /* Please modify this list when you add or remove RTP header
     67          extensions. */
     68          ["1", "urn:ietf:params:rtp-hdrext:ssrc-audio-level",""],
     69          ["3", "urn:ietf:params:rtp-hdrext:sdes:mid",""],
     70        ];
     71        // *Ugh* ...
     72        ok(JSON.stringify(audio) ===
     73           JSON.stringify(expected_audio),
     74           "List of answer audio URNs meets expected values");
     75 
     76        const video = sdputils.findExtmapIdsUrnsDirections(
     77            sdputils.getVideoMSections(test.originalAnswer.sdp));
     78        const expected_video = [
     79          /* Please modify this list when you add or remove RTP header
     80          extensions. */
     81          ["3", "urn:ietf:params:rtp-hdrext:sdes:mid",""],
     82          ["4", "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",""],
     83          ["5", "urn:ietf:params:rtp-hdrext:toffset",""],
     84          ["7", "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01", ""],
     85        ];
     86        ok(JSON.stringify(video) ===
     87           JSON.stringify(expected_video),
     88           "List of answer video URNs meets expected values");
     89      }
     90    ]);
     91 
     92    await test.run();
     93  });
     94 </script>
     95 </pre>
     96 </body>
     97 </html>