avcodec/dca_exss: always update downmix flags
authorfoo86 <foobaz86@gmail.com>
Mon, 23 May 2016 15:41:27 +0000 (18:41 +0300)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 23 May 2016 20:54:44 +0000 (22:54 +0200)
Fixes potential parsing failure when total number of channels indicated
by EXSS asset descriptor decreases mid-stream and stale embedded downmix
flags are referenced.

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

index 87b2f42..28f138f 100644 (file)
@@ -112,12 +112,10 @@ static int parse_descriptor(DCAExssParser *s, DCAExssAsset *asset)
             int nspeakers[8];
 
             // Embedded stereo flag
-            if (asset->nchannels_total > 2)
-                asset->embedded_stereo = get_bits1(&s->gb);
+            asset->embedded_stereo = asset->nchannels_total > 2 && get_bits1(&s->gb);
 
             // Embedded 6 channels flag
-            if (asset->nchannels_total > 6)
-                asset->embedded_6ch = get_bits1(&s->gb);
+            asset->embedded_6ch = asset->nchannels_total > 6 && get_bits1(&s->gb);
 
             // Speaker mask enabled flag
             if (asset->spkr_mask_enabled = get_bits1(&s->gb)) {