diff options
author | Nick Brereton | 2010-07-05 08:16:43 +0000 |
---|---|---|
committer | Benjamin Larsson | 2010-07-05 08:16:43 +0000 |
commit | 0712c230ae8b15f920e877e680e0fa6e856e8006 (patch) | |
tree | 8faf1a2ae2198e3b6f9253d4a1dd8711e8755249 /libavcodec/dca.c | |
parent | 03f0d1757568611c9150103c445e647d09149f70 (diff) |
DCA: Occasionally a false XCH sync word can turn up after the core DTS data,
to verify the sync word the extension fsize field should be compared to
the core data length field.
Patch by nick.nbrereton@net
Originally committed as revision 24054 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r-- | libavcodec/dca.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 989c6a286e..4b232c7006 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1298,7 +1298,13 @@ static int dca_decode_frame(AVCodecContext * avctx, switch(bits) { case 0x5a5a5a5a: { int ext_base_ch = s->prim_channels; - int ext_amode; + int ext_amode, xch_fsize; + + /* validate sync word using XCHFSIZE field */ + xch_fsize = show_bits(&s->gb, 10); + if((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && + (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) + continue; /* skip length-to-end-of-frame field for the moment */ skip_bits(&s->gb, 10); |