shithub: opus

Download patch

ref: b1d51b2d3f0118a598d8813c59e02fd596e12646
parent: 3105fa273c125faeda6b7168c74854a7f71a90c4
author: Andrew Larkin <andrewl@arcadius.com.au>
date: Thu Jul 6 07:00:36 EDT 2017

Fix uninitialized variables in decide_dtx_mode()

Signed-off-by: Felicia Lim <flim@google.com>

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -909,21 +909,20 @@
                            int arch
                           )
 {
-   int is_noise;
    opus_val32 noise_energy;
-   int is_sufficiently_quiet;
 
    if (!is_silence)
    {
-      is_noise = activity_probability < DTX_ACTIVITY_THRESHOLD;
-      if (is_noise)
+      if (activity_probability < DTX_ACTIVITY_THRESHOLD)  /* is noise */
       {
          noise_energy = compute_frame_energy(pcm, frame_size, channels, arch);
-         is_sufficiently_quiet = peak_signal_energy >= (PSEUDO_SNR_THRESHOLD * noise_energy);
+
+         /* but is sufficiently quiet */
+         is_silence = peak_signal_energy >= (PSEUDO_SNR_THRESHOLD * noise_energy);
       }
    }
 
-   if (is_silence || (is_noise && is_sufficiently_quiet))
+   if (is_silence)
    {
       /* The number of consecutive DTX frames should be within the allowed bounds */
       (*nb_no_activity_frames)++;