From f8eb44e83aa4d61fb758dcd7c64cc14140c06021 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Fri, 17 May 2013 23:22:09 -0400
Subject: [PATCH] Making sure redundant frames never use outdated analysis info

---
 src/opus_encoder.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 03692ec33..b6424d611 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1691,6 +1691,10 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
        ec_enc_shrink(&enc, nb_compr_bytes);
     }
 
+#ifndef FIXED_POINT
+    if (redundancy || st->mode != MODE_SILK_ONLY)
+       celt_encoder_ctl(celt_enc, CELT_SET_ANALYSIS(analysis_info));
+#endif
 
     /* 5 ms redundant frame for CELT->SILK */
     if (redundancy && celt_to_silk)
@@ -1724,9 +1728,6 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
         /* If false, we already busted the budget and we'll end up with a "PLC packet" */
         if (ec_tell(&enc) <= 8*nb_compr_bytes)
         {
-#ifndef FIXED_POINT
-           celt_encoder_ctl(celt_enc, CELT_SET_ANALYSIS(analysis_info));
-#endif
            ret = celt_encode_with_ec(celt_enc, pcm_buf, frame_size, NULL, nb_compr_bytes, &enc);
            if (ret < 0)
            {
-- 
GitLab