aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-11 20:13:23 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-12 20:24:29 +0100
commit6be0960851d41bb1aa2c9bebcbad45f715de939a (patch)
treea0000db49ac078cce8bcbf49e7d4588d780050bb
parentf900d601784ca69b5760bff5cb8f6dae333a79da (diff)
downloadffmpeg-6be0960851d41bb1aa2c9bebcbad45f715de939a.tar.gz
threads: move state update after progress cleanup.
This order is more logic and might prevent a race. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/pthread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 6ae763da80..0e64a325b1 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -386,14 +386,14 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
- p->state = STATE_INPUT_READY;
-
pthread_mutex_lock(&p->progress_mutex);
for (i = 0; i < MAX_BUFFERS; i++)
if (p->progress_used[i]) {
p->progress[i][0] = INT_MAX;
p->progress[i][1] = INT_MAX;
}
+ p->state = STATE_INPUT_READY;
+
pthread_cond_broadcast(&p->progress_cond);
pthread_cond_signal(&p->output_cond);
pthread_mutex_unlock(&p->progress_mutex);