tor-browser

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

audiochannelmerger-input-non-default.html (2353B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      ChannelMergerNode: Non-Default Input Handling
      6    </title>
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <script src="/webaudio/resources/audit-util.js"></script>
     10    <script src="/webaudio/resources/merger-testing.js"></script>
     11  </head>
     12  <body>
     13    <script>
     14      // Task: Check if an inactive input renders a silent mono channel in the
     15      // output.
     16      promise_test(async () => {
     17        await testMergerInput_W3CTH({
     18          numberOfChannels: 7,
     19 
     20          // Create a mono source buffer filled with '1'.
     21          testBufferContent: [1],
     22 
     23          // Connect the output of source into the 7th input of merger.
     24          mergerInputIndex: 6,
     25 
     26          // 7th channel should be '1'.
     27          expected: [0, 0, 0, 0, 0, 0, 1],
     28        });
     29      }, 'silent-channel');
     30 
     31      // Task: Check if a stereo input is being down-mixed to mono channel
     32      // correctly based on the mixing rule.
     33      promise_test(async () => {
     34        await testMergerInput_W3CTH({
     35          numberOfChannels: 7,
     36 
     37          // Create a stereo buffer filled with '1' and '2' for left and right
     38          // channels respectively.
     39          testBufferContent: [1, 2],
     40 
     41          // Connect the output of source into the 7th input of merger.
     42          mergerInputIndex: 6,
     43 
     44          // The result of summed and down-mixed stereo audio should be 1.5.
     45          // (= 1 * 0.5 + 2 * 0.5)
     46          expected: [0, 0, 0, 0, 0, 0, 1.5],
     47        });
     48      }, 'stereo-down-mixing');
     49 
     50      // Task: Check if 3-channel input gets processed by the 'discrete' mixing
     51      // rule.
     52      promise_test(async () => {
     53        await testMergerInput_W3CTH({
     54          numberOfChannels: 7,
     55 
     56          // Create a 3-channel buffer filled with '1', '2', and '3'
     57          // respectively.
     58          testBufferContent: [1, 2, 3],
     59 
     60          // Connect the output of source into the 7th input of merger.
     61          mergerInputIndex: 6,
     62 
     63          // The result of summed stereo audio should be 1 because 3-channel is
     64          // not a canonical layout, so the input channel 2 and 3 should be
     65          // dropped by 'discrete' mixing rule.
     66          expected: [0, 0, 0, 0, 0, 0, 1],
     67        });
     68      }, 'undefined-channel-layout');
     69    </script>
     70  </body>
     71 </html>