Commit 28e9ba95 authored by Paul B Mahol's avatar Paul B Mahol

avcodec/dnxhdenc: call slice thread code only if slice threading is enabled

parent 92da2309
...@@ -526,9 +526,11 @@ FF_DISABLE_DEPRECATION_WARNINGS ...@@ -526,9 +526,11 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS
#endif #endif
if (avctx->thread_count > MAX_THREADS) { if (avctx->active_thread_type == FF_THREAD_SLICE) {
av_log(avctx, AV_LOG_ERROR, "too many threads\n"); if (avctx->thread_count > MAX_THREADS) {
return AVERROR(EINVAL); av_log(avctx, AV_LOG_ERROR, "too many threads\n");
return AVERROR(EINVAL);
}
} }
if (avctx->qmax <= 1) { if (avctx->qmax <= 1) {
...@@ -537,9 +539,11 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -537,9 +539,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
} }
ctx->thread[0] = ctx; ctx->thread[0] = ctx;
for (i = 1; i < avctx->thread_count; i++) { if (avctx->active_thread_type == FF_THREAD_SLICE) {
ctx->thread[i] = av_malloc(sizeof(DNXHDEncContext)); for (i = 1; i < avctx->thread_count; i++) {
memcpy(ctx->thread[i], ctx, sizeof(DNXHDEncContext)); ctx->thread[i] = av_malloc(sizeof(DNXHDEncContext));
memcpy(ctx->thread[i], ctx, sizeof(DNXHDEncContext));
}
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment