Browse Source

avcodec/error_resilience: Fix handling of matrox mpeg2

Fixes Ticket2615

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer 11 years ago
parent
commit
7d776062f9
1 changed files with 15 additions and 0 deletions
  1. 15 0
      libavcodec/error_resilience.c

+ 15 - 0
libavcodec/error_resilience.c

@@ -860,6 +860,21 @@ void ff_er_frame_end(ERContext *s)
                           (s->avctx->skip_top + s->avctx->skip_bottom)) {
         return;
     }
+    for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
+        int status = s->error_status_table[mb_x + (s->mb_height - 1) * s->mb_stride];
+        if (status != 0x7F)
+            break;
+    }
+
+    if (   mb_x == s->mb_width
+        && s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO
+        && (s->avctx->height&16)
+        && s->error_count == 3 * s->mb_width * (s->avctx->skip_top + s->avctx->skip_bottom + 1)
+    ) {
+        av_log(s->avctx, AV_LOG_DEBUG, "ignoring last missing slice\n");
+        return;
+    }
+
     if (s->last_pic) {
         if (s->last_pic->f.width  != s->cur_pic->f.width  ||
             s->last_pic->f.height != s->cur_pic->f.height ||