Fixes a gapless buffering bug
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 27 Sep 2018 03:04:44 +0000 (23:04 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Thu, 27 Sep 2018 03:04:44 +0000 (23:04 -0400)
Thanks to Dmitry for reporting the bug.

src/opusenc.c

index 8f1d154..5716f89 100644 (file)
@@ -713,7 +713,7 @@ int ope_encoder_write_float(OggOpusEnc *enc, const float *pcm, int samples_per_c
     int i;
     if (samples_per_channel < LPC_INPUT) {
       for (i=0;i<(LPC_INPUT-samples_per_channel)*channels;i++) enc->lpc_buffer[i] = enc->lpc_buffer[samples_per_channel*channels + i];
-      for (i=0;i<samples_per_channel*channels;i++) enc->lpc_buffer[(LPC_INPUT-samples_per_channel)*channels] = pcm[i];
+      for (i=0;i<samples_per_channel*channels;i++) enc->lpc_buffer[(LPC_INPUT-samples_per_channel)*channels + i] = pcm[i];
     } else {
       for (i=0;i<LPC_INPUT*channels;i++) enc->lpc_buffer[i] = pcm[(samples_per_channel-LPC_INPUT)*channels + i];
     }