shithub: opus

Download patch

ref: ac9fabc7be6576dc9fed463eeda0c6c3574aa9c9
parent: dbff5fcaf60b32e21ee3750c4cc97a5021e57812
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Wed Sep 7 18:04:49 EDT 2016

Fixes an internal error in the Opus encoder

The encoder would reserve bytes for redundancy and then decide to use
CELT, but not use those bytes.

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1729,6 +1729,13 @@
         st->mode = MODE_HYBRID;
     if (st->mode == MODE_HYBRID && curr_bandwidth <= OPUS_BANDWIDTH_WIDEBAND)
         st->mode = MODE_SILK_ONLY;
+    /* If we decided to go with CELT, make sure redundancy is off, no matter what
+       we decided earlier. */
+    if (st->mode == MODE_CELT_ONLY)
+    {
+        redundancy = 0;
+        redundancy_bytes = 0;
+    }
 
     /* printf("%d %d %d %d\n", st->bitrate_bps, st->stream_channels, st->mode, curr_bandwidth); */
     bytes_target = IMIN(max_data_bytes-redundancy_bytes, st->bitrate_bps * frame_size / (st->Fs * 8)) - 1;