aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-03-02 13:08:15 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-03-03 14:15:11 +0100
commit5cdef40a789822c7d859cd756e781b91893f2c0d (patch)
tree3a12574093364026ed37cfff1257a0a876b50aa0 /libavcodec
parent4778b4dd77643267639d824ea33964ee7a98439d (diff)
downloadffmpeg-5cdef40a789822c7d859cd756e781b91893f2c0d.tar.gz
threads: allow thread count of zero
This moves setting the thread count to a minimum of 1 to frame_thread_init(), allowing a value of zero to propagate through to the codec if frame threading is not used. This makes auto-threads work in libx264. Signed-off-by: Mans Rullgard <mans@mansr.com> (cherry picked from commit ff1efc524cb3c60f2f746e3b4550bb1a86c65316)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pthread.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 5b0d108ba5..658dbacb89 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -683,6 +683,11 @@ static int frame_thread_init(AVCodecContext *avctx)
FrameThreadContext *fctx;
int i, err = 0;
+ if (thread_count <= 1) {
+ avctx->active_thread_type = 0;
+ return 0;
+ }
+
avctx->thread_opaque = fctx = av_mallocz(sizeof(FrameThreadContext));
fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
@@ -882,8 +887,6 @@ int ff_thread_init(AVCodecContext *avctx, int thread_count)
return -1;
}
- avctx->thread_count = FFMAX(1, thread_count);
-
if (avctx->codec) {
validate_thread_parameters(avctx);