lavc/mjpegdec: avoid unneeded allocation if the frame is to be skipped
authorMatthieu Bouron <matthieu.bouron@stupeflix.com>
Tue, 1 Mar 2016 17:15:48 +0000 (18:15 +0100)
committerMatthieu Bouron <matthieu.bouron@stupeflix.com>
Mon, 7 Mar 2016 11:36:23 +0000 (12:36 +0100)
libavcodec/mjpegdec.c

index f41f3a5..1e83e88 100644 (file)
@@ -614,6 +614,13 @@ unk_pixfmt:
         return AVERROR_BUG;
     }
 
+    if (s->avctx->skip_frame == AVDISCARD_ALL) {
+        s->picture_ptr->pict_type = AV_PICTURE_TYPE_I;
+        s->picture_ptr->key_frame = 1;
+        s->got_picture            = 1;
+        return 0;
+    }
+
     av_frame_unref(s->picture_ptr);
     if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0)
         return -1;