aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/pthread.c
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2010-01-20 22:55:50 +0000
committerMåns Rullgård <mans@mansr.com>2010-01-20 22:55:50 +0000
commit68cf92ee5e08331d6237a836adc74b4007fab4e9 (patch)
tree940d14641a23b82d9953953457338b1e9d2e11eb /libavcodec/pthread.c
parent5fcb865b7525f4ba6d601008bc6a2fb28be5af1e (diff)
downloadffmpeg-68cf92ee5e08331d6237a836adc74b4007fab4e9.tar.gz
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. Originally committed as revision 21358 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/pthread.c')
-rw-r--r--libavcodec/pthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 556e546188..60c82cd715 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -145,6 +145,11 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count)
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 @@ int avcodec_thread_init(AVCodecContext *avctx, int thread_count)
}
avctx->thread_opaque = c;
- avctx->thread_count = thread_count;
c->current_job = 0;
c->job_count = 0;
c->job_size = 0;