diff options
author | Måns Rullgård <mans@mansr.com> | 2010-01-21 01:55:50 +0300 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2010-01-21 01:55:50 +0300 |
commit | 68cf92ee5e08331d6237a836adc74b4007fab4e9 (patch) | |
tree | 940d14641a23b82d9953953457338b1e9d2e11eb /libavcodec/pthread.c | |
parent | 5fcb865b7525f4ba6d601008bc6a2fb28be5af1e (diff) |
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.c | 6 |
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; |