]> git.sesse.net Git - ffmpeg/commitdiff
pthread_frame: unref decoded frames on failure
authorAnton Khirnov <anton@khirnov.net>
Thu, 28 Nov 2013 09:54:35 +0000 (10:54 +0100)
committerAnton Khirnov <anton@khirnov.net>
Mon, 6 Jan 2014 07:25:55 +0000 (08:25 +0100)
This is similar to what the non-threaded code already does.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

libavcodec/pthread_frame.c

index ece0e804b17869ed8a82c80256af4f5d1739ff2b..36b4fff0bb139a618b050752611fe8377ea51269 100644 (file)
@@ -144,6 +144,13 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
         p->got_frame = 0;
         p->result = codec->decode(avctx, p->frame, &p->got_frame, &p->avpkt);
 
+        if ((p->result < 0 || !p->got_frame) && p->frame->buf[0]) {
+            if (avctx->internal->allocate_progress)
+                av_log(avctx, AV_LOG_ERROR, "A frame threaded decoder did not "
+                       "free the frame on failure. This is a bug, please report it.\n");
+            av_frame_unref(p->frame);
+        }
+
         if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
 
         p->state = STATE_INPUT_READY;