diff --git a/README.md b/README.md index e72a431..c105986 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,7 @@ The test emits a beep using device speakers that it listens for on the device's ## Homepage (with latency data) https://superpowered.com/webbrowserlatency + +## Run it locally + +`python3 -m http.server` \ No newline at end of file diff --git a/latencyMeasurer.js b/latencyMeasurer.js index f2d2460..fe27c07 100644 --- a/latencyMeasurer.js +++ b/latencyMeasurer.js @@ -43,6 +43,11 @@ class latencyMeasurer { } processInput(left, right, _samplerate, numberOfSamples) { + // Possible fix for Firefox + /*if (!left || !right) { + console.error("Undefined buffers received:", { left, right }); + return; + }*/ this.rampdec = -1.0; this.samplerate = _samplerate; this.buffersize = numberOfSamples; @@ -119,6 +124,7 @@ class latencyMeasurer { this.rampdec = 1.0 / numberOfSamples; this.measurementState = this.nextMeasurementState = measurementStates.waiting; this.latencyMs = -1; + this.samplesElapsed = 0; } } break; diff --git a/processor.js b/processor.js index ca782fc..1ca73e9 100644 --- a/processor.js +++ b/processor.js @@ -11,6 +11,7 @@ class MyProcessor extends AudioWorkletProcessor { } process(inputs, outputs, parameters) { + if(!inputs[0].length) return let inBufferL = null, inBufferR = null, outBufferL = null, outBufferR = null; if (typeof inputs.getChannelData === 'function') { inBufferL = inputs.getChannelData(0);