| <!DOCTYPE html> |
| <html> |
| <head> |
| <title> |
| Test performance of 100 AudioWorkletNodes (bypassing). |
| </title> |
| <script src="../resources/runner.js"></script> |
| <script src="resources/webaudio-perf-utils.js"></script> |
| </head> |
| <body> |
| <script> |
| async function graphBuilder() { |
| const context = new OfflineAudioContext(1, 48000, 48000); |
| await context.audioWorklet.addModule('resources/bypass-processor.js'); |
| const source = new ConstantSourceNode(context); |
| |
| // Create 100 AudioWorkletNodes that are serially connected. |
| const testNodes = []; |
| for (let i = 0; i < 100; ++i) { |
| testNodes.push(new AudioWorkletNode(context, 'bypass-processor')); |
| if (i === 0) continue; |
| testNodes[i - 1].connect(testNodes[i]); |
| } |
| |
| source.connect(testNodes[0]); |
| testNodes[99].connect(context.destination); |
| source.start(); |
| return context; |
| } |
| |
| RunWebAudioPerfTest({ |
| description: 'Test performance of 100 AudioWorkletNodes (bypassing)', |
| graphBuilder: graphBuilder, |
| tracingOptions: { |
| targetCategory: 'disabled-by-default-webaudio.audionode', |
| targetEvents: ['AudioWorkletHandler::Process'], |
| } |
| }); |
| </script> |
| </body> |
| </html> |