| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 | |
| 4 <head> | |
| 5 <script src="../resources/js-test.js"></script> | |
| 6 <script src="resources/compatibility.js"></script> | |
| 7 <script src="resources/audit-util.js"></script> | |
| 8 <script src="resources/audio-testing.js"></script> | |
| 9 <script src="resources/merger-testing.js"></script> | |
| 10 </head> | |
| 11 | |
| 12 <body> | |
| 13 <script> | |
| 14 description('Test input handling of ChannelMergerNode (non-default).'); | |
| 15 window.jsTestIsAsync = true; | |
| 16 | |
| 17 var audit = Audit.createTaskRunner(); | |
| 18 | |
| 19 | |
| 20 // Task: Check if an inactive input renders a silent mono channel in the | |
| 21 // output. | |
| 22 audit.defineTask('silent-channel', function (done) { | |
| 23 testMergerInput({ | |
| 24 numberOfChannels: 7, | |
| 25 | |
| 26 // Create a mono source buffer filled with '1'. | |
| 27 testBufferContent: [1], | |
| 28 | |
| 29 // Connect the output of source into the 7th input of merger. | |
| 30 mergerInputIndex: 6, | |
| 31 | |
| 32 // 7th channel should be '1'. | |
| 33 expected: [0, 0, 0, 0, 0, 0, 1], | |
| 34 }, done); | |
| 35 }); | |
| 36 | |
| 37 | |
| 38 // Task: Check if a stereo input is being down-mixed to mono channel | |
| 39 // correctly based on the mixing rule. | |
| 40 audit.defineTask('stereo-down-mixing', function (done) { | |
| 41 testMergerInput({ | |
| 42 numberOfChannels: 7, | |
| 43 | |
| 44 // Create a stereo buffer filled with '1' and '2' for left and right | |
| 45 // channels respectively. | |
| 46 testBufferContent: [1, 2], | |
| 47 | |
| 48 // Connect the output of source into the 7th input of merger. | |
| 49 mergerInputIndex: 6, | |
| 50 | |
| 51 // The result of summed and down-mixed stereo audio should be 1.5. | |
| 52 // (= 1 * 0.5 + 2 * 0.5) | |
| 53 expected: [0, 0, 0, 0, 0, 0, 1.5], | |
| 54 }, done); | |
| 55 }); | |
| 56 | |
| 57 | |
| 58 // Task: Check if 3-channel input gets processed by the 'discrete' mixing | |
| 59 // rule. | |
| 60 audit.defineTask('undefined-channel-layout', function (done) { | |
| 61 testMergerInput({ | |
| 62 numberOfChannels: 7, | |
| 63 | |
| 64 // Create a 3-channel buffer filled with '1', '2', and '3' respectively. | |
| 65 testBufferContent: [1, 2, 3], | |
| 66 | |
| 67 // Connect the output of source into the 7th input of merger. | |
| 68 mergerInputIndex: 6, | |
| 69 | |
| 70 // The result of summed stereo audio should be 1 because 3-channel is | |
| 71 // not a canonical layout, so the input channel 2 and 3 should be | |
| 72 // dropped by 'discrete' mixing rule. | |
| 73 expected: [0, 0, 0, 0, 0, 0, 1], | |
| 74 }, done); | |
| 75 }); | |
| 76 | |
| 77 audit.defineTask('finish', function (done) { | |
| 78 finishJSTest(); | |
| 79 done(); | |
| 80 }); | |
| 81 | |
| 82 audit.runTasks( | |
| 83 'silent-channel', | |
| 84 'stereo-down-mixing', | |
| 85 'undefined-channel-layout', | |
| 86 'finish' | |
| 87 ); | |
| 88 | |
| 89 successfullyParsed = true; | |
| 90 </script> | |
| 91 </body> | |
| 92 | |
| 93 </html> | |
| OLD | NEW |