[FFmpeg-cvslog] pthread_frame: unref decoded frames on failure

Anton Khirnov git at videolan.org
Mon Jan 6 17:08:40 CET 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Nov 28 10:54:35 2013 +0100| [9cbf2d78f0a9c19129e7a70b2281a450d386c6d9] | committer: Anton Khirnov

pthread_frame: unref decoded frames on failure

This is similar to what the non-threaded code already does.

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

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

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

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index ece0e80..36b4fff 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -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;



More information about the ffmpeg-cvslog mailing list