ref: 5da76ecdf4487b1ec4f60d0c912a4539c9d6ec9e
parent: caeda87b35ab4e0522deb0a943571cffbedc377e
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Mon Jun 19 09:06:25 EDT 2017
Fixes shift_buffer() to actually preserve the first LPC_INPUT samples
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -393,7 +393,8 @@
static void shift_buffer(OggOpusEnc *enc) {
/* Leaving enough in the buffer to do LPC extension if needed. */
if (enc->buffer_start > LPC_INPUT) {
- memmove(&enc->buffer[enc->channels*LPC_INPUT], &enc->buffer[enc->channels*enc->buffer_start], enc->channels*(enc->buffer_end-enc->buffer_start)*sizeof(*enc->buffer));
+ memmove(&enc->buffer[0], &enc->buffer[enc->channels*(enc->buffer_start-LPC_INPUT)],
+ enc->channels*(enc->buffer_end-enc->buffer_start+LPC_INPUT)*sizeof(*enc->buffer));
enc->buffer_end -= enc->buffer_start-LPC_INPUT;
enc->buffer_start = LPC_INPUT;
}