shithub: opus

Download patch

ref: 2b98bdf53253b6b85fffe7f1bfa9141ae9b09e61
parent: d48277374a154fe5236825e8aa739b6ee392e3e5
author: Jean-Marc Valin <[email protected]>
date: Fri Aug 19 20:21:46 EDT 2011

Better handling of DTX for range coder state checks

--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -442,7 +442,10 @@
     	            st->channels, window, st->Fs);
     }
 
-    st->rangeFinal = dec.rng ^ redundant_rng;
+    if (len <= 1)
+       st->rangeFinal = 0;
+    else
+       st->rangeFinal = dec.rng ^ redundant_rng;
 
     st->prev_mode = mode;
     st->prev_redundancy = redundancy;
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -261,6 +261,7 @@
     opus_uint32 redundant_rng = 0;
     ALLOC_STACK;
 
+    st->rangeFinal = 0;
     if (400*frame_size != st->Fs && 200*frame_size != st->Fs && 100*frame_size != st->Fs &&
          50*frame_size != st->Fs &&  25*frame_size != st->Fs &&  50*frame_size != 3*st->Fs)
         return OPUS_BAD_ARG;