Browse code

avcodec/ac3dec: Reset SPX when switching from EAC3 to AC3

Fixes Ticket5319

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

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2016/04/25 11:08:21
Showing 1 changed files
... ...
@@ -901,11 +901,13 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
901 901
                                   ff_eac3_default_spx_band_struct,
902 902
                                   &s->num_spx_bands,
903 903
                                   s->spx_band_sizes);
904
-        } else {
905
-            for (ch = 1; ch <= fbw_channels; ch++) {
906
-                s->channel_uses_spx[ch] = 0;
907
-                s->first_spx_coords[ch] = 1;
908
-            }
904
+        }
905
+    }
906
+    if (!s->eac3 || !s->spx_in_use) {
907
+        s->spx_in_use = 0;
908
+        for (ch = 1; ch <= fbw_channels; ch++) {
909
+            s->channel_uses_spx[ch] = 0;
910
+            s->first_spx_coords[ch] = 1;
909 911
         }
910 912
     }
911 913