summaryrefslogtreecommitdiff
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-13 05:42:01 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-13 06:22:04 +0100
commita6e4796fbf0aa9b13451a8ef917ecc4e80d1d272 (patch)
treebf1bbe67f652cf8329d5ddfa0a18d6c5bb4f52b1 /libavcodec/pthread.c
parent2ea3f37d5f974ab79a3a777e42f5dbfac17c1959 (diff)
pthread: Do not use a half updated context as master for deallocation.
Fixes assertion failure Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index b55cccf200..2bd8df8e0a 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -754,7 +754,11 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count)
park_frame_worker_threads(fctx, thread_count);
if (fctx->prev_thread && fctx->prev_thread != fctx->threads)
- update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0);
+ if (update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Final thread update failed\n");
+ fctx->prev_thread->avctx->internal->is_copy = fctx->threads->avctx->internal->is_copy;
+ fctx->threads->avctx->internal->is_copy = 1;
+ }
fctx->die = 1;