shithub: opus

Download patch

ref: 57092f9dca12f587a5fc1625f45d88c6977edc81
parent: a7aa7fb382416ff257ab352c3b9cf3d46da51f56
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Wed Feb 13 08:33:42 EST 2019

Improve silence handling

Copy the previous analysis data instead of flagging as invalid

--- a/src/analysis.c
+++ b/src/analysis.c
@@ -547,7 +547,11 @@
     tonal->mem_fill = 240 + remaining;
     if (is_silence)
     {
-       info->valid = 0;
+       /* On silence, copy the previous analysis. */
+       int prev_pos = tonal->write_pos-2;
+       if (prev_pos < 0)
+          prev_pos += DETECT_SIZE;
+       OPUS_COPY(info, &tonal->info[prev_pos], 1);
        RESTORE_STACK;
        return;
     }