shithub: opus

Download patch

ref: 12c39929630012d40e8b7a096f2382072e9749a7
parent: 2e7feb51249b620d9b441fdb88699cfc7560f7e8
author: Jean-Marc Valin <[email protected]>
date: Sun Sep 4 07:00:29 EDT 2011

Fixes a buffering bug introduced in 2f0ca7618

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -758,7 +758,9 @@
         nb_compr_bytes = 0;
     }
 
-    for (i=0;i<st->encoder_buffer*st->channels;i++)
+    for (i=0;i<st->channels*(st->encoder_buffer-(frame_size+st->delay_compensation));i++)
+        st->delay_buffer[i] = st->delay_buffer[i+st->channels*frame_size];
+    for (;i<st->encoder_buffer*st->channels;i++)
         st->delay_buffer[i] = pcm_buf[(frame_size+st->delay_compensation-st->encoder_buffer)*st->channels+i];