summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerAnton Khirnov <anton@khirnov.net>2014-01-06 08:25:55 +0100
commit9cbf2d78f0a9c19129e7a70b2281a450d386c6d9 (patch)
treeb17e0772322c7e61a14436fc0138cb6191c64f5c /libavcodec/pthread_frame.c
parenta03a642d5ceb5f2f7c6ebbf56ff365dfbcdb65eb (diff)
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@libav.org
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index ece0e804b1..36b4fff0bb 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;