From acf6e364e709e4b4d8a7e9f0e1320a29833083cc Mon Sep 17 00:00:00 2001 From: Glenn Harper <64209257+glharper@users.noreply.github.com> Date: Tue, 13 Jul 2021 15:14:40 -0700 Subject: [PATCH] Glharper/audio input reattach fix (#402) * Fix push stream not being reconnected to with start-stop-start continuous recognition, add test * change timeout for added test * Fix error when down sampling with audioWorkletNode --- src/common/RiffPcmEncoder.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/RiffPcmEncoder.ts b/src/common/RiffPcmEncoder.ts index 45c9748d..18d90cab 100644 --- a/src/common/RiffPcmEncoder.ts +++ b/src/common/RiffPcmEncoder.ts @@ -47,6 +47,10 @@ export class RiffPcmEncoder { srcRate: number, dstRate: number): Float32Array => { + if (!srcFrame) { + return null; + } + if (dstRate === srcRate || dstRate > srcRate) { return srcFrame; }