oops
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 30 Apr 2017 04:44:48 +0000 (00:44 -0400)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Sun, 30 Apr 2017 04:44:48 +0000 (00:44 -0400)
src/opusenc.c

index 14f09c8..d748a44 100644 (file)
@@ -305,7 +305,7 @@ int ope_write_float(OggOpusEnc *enc, float *pcm, int samples_per_channel) {
       enc->buffer[channels*enc->buffer_end+i] = pcm[i];
     }
     enc->buffer_end += curr;
-    pcm += curr;
+    pcm += curr*channels;
     samples_per_channel -= curr;
     encode_buffer(enc);
   } while (samples_per_channel > 0);
@@ -326,7 +326,7 @@ int ope_write(OggOpusEnc *enc, opus_int16 *pcm, int samples_per_channel) {
       enc->buffer[channels*enc->buffer_end+i] = (1.f/32768)*pcm[i];
     }
     enc->buffer_end += curr;
-    pcm += curr;
+    pcm += curr*channels;
     samples_per_channel -= curr;
     encode_buffer(enc);
   } while (samples_per_channel > 0);