avcodec/ac3dec: Reset SPX when switching from EAC3 to AC3
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 25 Apr 2016 02:08:21 +0000 (04:08 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 27 Apr 2016 02:40:12 +0000 (04:40 +0200)
Fixes Ticket5319

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9ac154d1facd4756db6918f866dccf3e3ffb698c)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ac3dec.c

index 3982247..4ad99ce 100644 (file)
@@ -901,11 +901,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
                                   ff_eac3_default_spx_band_struct,
                                   &s->num_spx_bands,
                                   s->spx_band_sizes);
-        } else {
-            for (ch = 1; ch <= fbw_channels; ch++) {
-                s->channel_uses_spx[ch] = 0;
-                s->first_spx_coords[ch] = 1;
-            }
+        }
+    }
+    if (!s->eac3 || !s->spx_in_use) {
+        s->spx_in_use = 0;
+        for (ch = 1; ch <= fbw_channels; ch++) {
+            s->channel_uses_spx[ch] = 0;
+            s->first_spx_coords[ch] = 1;
         }
     }