Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
6 changes: 6 additions & 0 deletions latencyMeasurer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -119,6 +124,7 @@ class latencyMeasurer {
this.rampdec = 1.0 / numberOfSamples;
this.measurementState = this.nextMeasurementState = measurementStates.waiting;
this.latencyMs = -1;
this.samplesElapsed = 0;
}
}
break;
Expand Down
1 change: 1 addition & 0 deletions processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down