From 7e3f23966dd0f5fd7f084837ca359c864a3851f0 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Thu, 10 Aug 2023 15:43:44 +0200 Subject: [PATCH] voice - prevent wrong data assumptions in processor --- .../electron-sandbox/bufferInputAudioProcessor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vs/workbench/services/voiceRecognition/electron-sandbox/bufferInputAudioProcessor.js b/src/vs/workbench/services/voiceRecognition/electron-sandbox/bufferInputAudioProcessor.js index bc87ec89076..f1473538c68 100644 --- a/src/vs/workbench/services/voiceRecognition/electron-sandbox/bufferInputAudioProcessor.js +++ b/src/vs/workbench/services/voiceRecognition/electron-sandbox/bufferInputAudioProcessor.js @@ -29,6 +29,10 @@ class BufferInputAudioProcessor extends AudioWorkletProcessor { } const inputChannelData = inputs[0][0]; + if ((!(inputChannelData instanceof Float32Array))) { + return; + } + this.currentInputUint8Arrays.push(this.float32ArrayToUint8Array(inputChannelData.slice(0))); if (Date.now() - this.startTime > this.bufferTimespan) {