diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-08-17 12:42:16 +0300 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2017-08-17 12:42:16 +0300 |
commit | 28e9ba951d1a0b0aca53b242aa64f484ca75e874 (patch) | |
tree | f73c9fceffb6ae97b2f0436dd00c1280b7b7f9d0 /libavcodec/dnxhdenc.c | |
parent | 92da23093c784b1d9f0db4db51d28ea80a59e759 (diff) |
avcodec/dnxhdenc: call slice thread code only if slice threading is enabled
Diffstat (limited to 'libavcodec/dnxhdenc.c')
-rw-r--r-- | libavcodec/dnxhdenc.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index f8bf7db90a..5a0e6de6a5 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -526,9 +526,11 @@ FF_DISABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS #endif - if (avctx->thread_count > MAX_THREADS) { - av_log(avctx, AV_LOG_ERROR, "too many threads\n"); - return AVERROR(EINVAL); + if (avctx->active_thread_type == FF_THREAD_SLICE) { + if (avctx->thread_count > MAX_THREADS) { + av_log(avctx, AV_LOG_ERROR, "too many threads\n"); + return AVERROR(EINVAL); + } } if (avctx->qmax <= 1) { @@ -537,9 +539,11 @@ FF_ENABLE_DEPRECATION_WARNINGS } ctx->thread[0] = ctx; - for (i = 1; i < avctx->thread_count; i++) { - ctx->thread[i] = av_malloc(sizeof(DNXHDEncContext)); - memcpy(ctx->thread[i], ctx, sizeof(DNXHDEncContext)); + if (avctx->active_thread_type == FF_THREAD_SLICE) { + for (i = 1; i < avctx->thread_count; i++) { + ctx->thread[i] = av_malloc(sizeof(DNXHDEncContext)); + memcpy(ctx->thread[i], ctx, sizeof(DNXHDEncContext)); + } } return 0; |