fix(noise-suppression) exit out early if no input data to Worklet
Disconnecting the input node to the worklet causes the worklet to crash. Adding a guard clause for empty input prevents this.
This commit is contained in:
parent
a915238b49
commit
51ac3ef64a
|
@ -106,6 +106,12 @@ class NoiseSuppressorWorklet extends AudioWorkletProcessor {
|
||||||
const inData = inputs[0][0];
|
const inData = inputs[0][0];
|
||||||
const outData = outputs[0][0];
|
const outData = outputs[0][0];
|
||||||
|
|
||||||
|
// Exit out early if there is no input data (input node not connected/disconnected)
|
||||||
|
// as rest of worklet will crash otherwise
|
||||||
|
if (!inData) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Append new raw PCM sample.
|
// Append new raw PCM sample.
|
||||||
this._circularBuffer.set(inData, this._inputBufferLength);
|
this._circularBuffer.set(inData, this._inputBufferLength);
|
||||||
this._inputBufferLength += inData.length;
|
this._inputBufferLength += inData.length;
|
||||||
|
|
Loading…
Reference in New Issue