shithub: opus

Download patch

ref: be68a9ae94a1f50c8c7a22f2bdd76ab12fd71a1b
parent: 3880c5abdd8765c510ee3262d3888df848deff0c
author: Jesús de Vicente Peña <devicentepena@webrtc.org>
date: Tue Feb 11 04:27:10 EST 2020

Fix for an assertion when running the fixed point tests

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

--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1152,16 +1152,18 @@
     if (!is_silence)
       st->voice_ratio = -1;
 
-    if (analysis_info.valid) {
-       activity = !is_silence &&
-              analysis_info.activity_probability >= DTX_ACTIVITY_THRESHOLD;
-       if (!activity) {
-          opus_val32 noise_energy = compute_frame_energy(pcm, frame_size, st->channels, st->arch);
-          /* do not mark as active unless is sufficiently quiet */
-          activity = st->peak_signal_energy < (PSEUDO_SNR_THRESHOLD * noise_energy);
-       }
-    } else {
+    if (is_silence)
+    {
        activity = !is_silence;
+    } else if (analysis_info.valid)
+    {
+       activity = analysis_info.activity_probability >= DTX_ACTIVITY_THRESHOLD;
+       if (!activity)
+       {
+           /* Mark as active if this noise frame is sufficiently loud */
+           opus_val32 noise_energy = compute_frame_energy(pcm, frame_size, st->channels, st->arch);
+           activity = st->peak_signal_energy < (PSEUDO_SNR_THRESHOLD * noise_energy);
+       }
     }
 
     st->detected_bandwidth = 0;