# HG changeset patch # User mru # Date 1264028150 0 # Node ID d7ef6611a49e9b3e7dea43955ab2eab5a02d0a5e # Parent eb9a2581f50ea3f865bb80ba98c5b888cc8680c1 Always call avcodec_thread_init() The various avcodec_thread_init() functions are updated to return immediately after setting avctx->thread_count. This allows -threads 0 to pass through to codecs. It also simplifies the usage for apps using libavcodec. diff -r eb9a2581f50e -r d7ef6611a49e beosthread.c --- a/beosthread.c Wed Jan 20 19:23:19 2010 +0000 +++ b/beosthread.c Wed Jan 20 22:55:50 2010 +0000 @@ -123,6 +123,9 @@ s->thread_count= thread_count; + if (thread_count <= 1) + return 0; + assert(!s->thread_opaque); c= av_mallocz(sizeof(ThreadContext)*thread_count); s->thread_opaque= c; diff -r eb9a2581f50e -r d7ef6611a49e os2thread.c --- a/os2thread.c Wed Jan 20 19:23:19 2010 +0000 +++ b/os2thread.c Wed Jan 20 22:55:50 2010 +0000 @@ -116,6 +116,9 @@ s->thread_count= thread_count; + if (thread_count <= 1) + return 0; + assert(!s->thread_opaque); c= av_mallocz(sizeof(ThreadContext)*thread_count); s->thread_opaque= c; diff -r eb9a2581f50e -r d7ef6611a49e pthread.c --- a/pthread.c Wed Jan 20 19:23:19 2010 +0000 +++ b/pthread.c Wed Jan 20 22:55:50 2010 +0000 @@ -145,6 +145,11 @@ int i; ThreadContext *c; + avctx->thread_count = thread_count; + + if (thread_count <= 1) + return 0; + c = av_mallocz(sizeof(ThreadContext)); if (!c) return -1; @@ -156,7 +161,6 @@ } avctx->thread_opaque = c; - avctx->thread_count = thread_count; c->current_job = 0; c->job_count = 0; c->job_size = 0; diff -r eb9a2581f50e -r d7ef6611a49e w32thread.c --- a/w32thread.c Wed Jan 20 19:23:19 2010 +0000 +++ b/w32thread.c Wed Jan 20 22:55:50 2010 +0000 @@ -131,6 +131,9 @@ s->thread_count= thread_count; + if (thread_count <= 1) + return 0; + assert(!s->thread_opaque); c= av_mallocz(sizeof(ThreadContext)*thread_count); s->thread_opaque= c;