[FFmpeg-cvslog] lavc/mjpegdec: avoid unneeded allocation if the frame is to be skipped

Matthieu Bouron git at videolan.org
Mon Mar 7 12:42:36 CET 2016


ffmpeg | branch: master | Matthieu Bouron <matthieu.bouron at stupeflix.com> | Tue Mar  1 18:15:48 2016 +0100| [81f14884b59334b765eddb64b0dc8ca5dec7f9bd] | committer: Matthieu Bouron

lavc/mjpegdec: avoid unneeded allocation if the frame is to be skipped

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81f14884b59334b765eddb64b0dc8ca5dec7f9bd
---

 libavcodec/mjpegdec.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index f41f3a5..1e83e88 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -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;



More information about the ffmpeg-cvslog mailing list