diff --git a/packages/livekit-rtc/src/audio_resampler.ts b/packages/livekit-rtc/src/audio_resampler.ts index 9bc16793..f6cb649f 100644 --- a/packages/livekit-rtc/src/audio_resampler.ts +++ b/packages/livekit-rtc/src/audio_resampler.ts @@ -121,7 +121,7 @@ export class AudioResampler { new Int16Array(outputData.subarray()), this.#outputRate, this.#channels, - outputData.length, + Math.trunc(outputData.length / this.#channels / 2), ), ]; } @@ -159,7 +159,7 @@ export class AudioResampler { new Int16Array(outputData.subarray()), this.#outputRate, this.#channels, - outputData.length, + Math.trunc(outputData.length / this.#channels / 2), ), ]; }