Browse code

threads: fix a potential race spotted by helgrind.

Clément Bœsch authored on 2012/07/20 02:08:31
Showing 1 changed files
... ...
@@ -975,9 +975,9 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
975 975
         avctx->get_buffer == avcodec_default_get_buffer) {
976 976
         err = avctx->get_buffer(avctx, f);
977 977
     } else {
978
+        pthread_mutex_lock(&p->progress_mutex);
978 979
         p->requested_frame = f;
979 980
         p->state = STATE_GET_BUFFER;
980
-        pthread_mutex_lock(&p->progress_mutex);
981 981
         pthread_cond_broadcast(&p->progress_cond);
982 982
 
983 983
         while (p->state != STATE_SETTING_UP)