avcodec/mpeg12dec: fix support for interlaced mpeg2 with missing last slice
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 1 Aug 2014 19:10:43 +0000 (21:10 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 1 Aug 2014 19:20:43 +0000 (21:20 +0200)
Fixes Ticket3809

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f95298c913899207344d668a6d5624cb2d2e480c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpeg12dec.c

index fcc1d4c..0eecb7d 100644 (file)
@@ -1884,6 +1884,14 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
                 } else
                     goto eos;
             }
+            if (s->mb_y >= ((s->height + 15) >> 4) &&
+                s->progressive_frame &&
+                !s->progressive_sequence &&
+                get_bits_left(&s->gb) <= 8 &&
+                get_bits_left(&s->gb) >= 0 &&
+                s->mb_skip_run == -1 &&
+                show_bits(&s->gb, 8) == 0)
+                goto eos;
 
             ff_init_block_index(s);
         }