shithub: opus

Download patch

ref: d9dd4992da714aabcc8a3eafa5fcae1c21c50a71
parent: ebb1cd16d778e5e43101182b1c1ce1d5d55ed1c3
author: Gregory Maxwell <[email protected]>
date: Sun Oct 16 00:02:02 EDT 2011

Correct rare mismatch between the encoder and decoder introduced by e9b53212.

Only one of the two required checks in the encoder were updated. Thanks to
Tim for tracking down the actual cause of the mismatch.

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -930,7 +930,7 @@
     if ( st->mode != MODE_CELT_ONLY && ec_tell(&enc)+17+20*(st->mode == MODE_HYBRID) <= 8*(max_data_bytes-1))
     {
         /* For SILK mode, the redundancy is inferred from the length */
-        if (st->mode == MODE_HYBRID && (redundancy || ec_tell(&enc)+37 < 8*nb_compr_bytes))
+        if (st->mode == MODE_HYBRID && (redundancy || ec_tell(&enc)+37 <= 8*nb_compr_bytes))
            ec_enc_bit_logp(&enc, redundancy, 12);
         if (redundancy)
         {