[FFmpeg-cvslog] lavc/pthread_frame: protect read state access in setup finish function

Clément Bœsch git at videolan.org
Mon Jan 16 11:43:21 EET 2017


ffmpeg | branch: master | Clément Bœsch <cboesch at gopro.com> | Wed Jan 11 17:10:07 2017 +0100| [a91c265f393b72925dc440f79b3ec4ec7aba575f] | committer: Clément Bœsch

lavc/pthread_frame: protect read state access in setup finish function

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

 libavcodec/pthread_frame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 7ef5e9f..cb6d762 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -509,11 +509,11 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
 
     if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
 
+    pthread_mutex_lock(&p->progress_mutex);
     if(p->state == STATE_SETUP_FINISHED){
         av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n");
     }
 
-    pthread_mutex_lock(&p->progress_mutex);
     p->state = STATE_SETUP_FINISHED;
     pthread_cond_broadcast(&p->progress_cond);
     pthread_mutex_unlock(&p->progress_mutex);



More information about the ffmpeg-cvslog mailing list