From 94660c35249e11c53b9a9f0c2f85c4335b21eda7 Mon Sep 17 00:00:00 2001
From: Janne Grunau <janne-libav@jannau.net>
Date: Mon, 22 Apr 2013 15:31:58 +0200
Subject: [PATCH] threads: always call thread_finish_setup for intra codecs

Intra codecs do not need an update_thread_context() function and never
call ff_thread_finish_setup(). They rely on ff_thread_get_buffer()
calling it. So call it even if the get_buffer2 function pointer is
avcodec_default_get_buffer2 and it has not been called before.
---
 libavcodec/pthread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 404804dec18..1dbfe3d221c 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -947,9 +947,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
 
         pthread_mutex_unlock(&p->progress_mutex);
 
-        if (!avctx->codec->update_thread_context)
-            ff_thread_finish_setup(avctx);
     }
+    if (!avctx->thread_safe_callbacks && !avctx->codec->update_thread_context)
+        ff_thread_finish_setup(avctx);
 
     if (err)
         av_buffer_unref(&f->progress);
-- 
GitLab