[FFmpeg-cvslog] pthread: Do not use a half updated context as master for deallocation.

Michael Niedermayer git at videolan.org
Sun Jan 13 06:38:38 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 13 05:42:01 2013 +0100| [a6e4796fbf0aa9b13451a8ef917ecc4e80d1d272] | committer: Michael Niedermayer

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 at gmx.at>

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

 libavcodec/pthread.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index b55cccf..2bd8df8 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;
 



More information about the ffmpeg-cvslog mailing list