This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 6a030f3dd25201e49c946d37fa5d66cc2b3882c8 Author: Zhao Zhili <[email protected]> AuthorDate: Sun Aug 2 20:27:27 2026 +0800 Commit: Zhao Zhili <[email protected]> CommitDate: Sat Sep 26 15:32:47 2026 +0000 libavfilter/dnn: guard pthread_join on never-started async threads ff_dnn_async_module_cleanup and ff_dnn_start_inference_async unconditionally pthread_join() thread_id, which is zeroed by av_mallocz until pthread_create runs. The first call to either helper joins a never-created handle, which strict_pthread_join turns into abort(). --- libavfilter/dnn/dnn_backend_common.c | 24 ++++++++++++++++-------- libavfilter/dnn/dnn_backend_common.h | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_common.c b/libavfilter/dnn/dnn_backend_common.c index 4d90efecd4..6c52d6e86b 100644 --- a/libavfilter/dnn/dnn_backend_common.c +++ b/libavfilter/dnn/dnn_backend_common.c @@ -89,10 +89,13 @@ int ff_dnn_async_module_cleanup(DNNAsyncExecModule *async_module) if (!async_module) { return AVERROR(EINVAL); } - pthread_join(async_module->thread_id, &status); - if (status == DNN_ASYNC_FAIL) { - av_log(NULL, AV_LOG_ERROR, "Last Inference Failed.\n"); - return DNN_GENERIC_ERROR; + if (async_module->thread_started) { + pthread_join(async_module->thread_id, &status); + async_module->thread_started = 0; + if (status == DNN_ASYNC_FAIL) { + av_log(NULL, AV_LOG_ERROR, "Last Inference Failed.\n"); + return DNN_GENERIC_ERROR; + } } async_module->start_inference = NULL; async_module->callback = NULL; @@ -118,16 +121,21 @@ int ff_dnn_start_inference_async(void *ctx, DNNAsyncExecModule *async_module) return AVERROR(EINVAL); } - pthread_join(async_module->thread_id, &status); - if (status == DNN_ASYNC_FAIL) { - av_log(ctx, AV_LOG_ERROR, "Unable to start inference as previous inference failed.\n"); - return DNN_GENERIC_ERROR; + if (async_module->thread_started) { + pthread_join(async_module->thread_id, &status); + async_module->thread_started = 0; + if (status == DNN_ASYNC_FAIL) { + av_log(ctx, AV_LOG_ERROR, "Unable to start inference as previous inference failed.\n"); + return DNN_GENERIC_ERROR; + } } ret = pthread_create(&async_module->thread_id, NULL, async_thread_routine, async_module); if (ret != 0) { av_log(ctx, AV_LOG_ERROR, "Unable to start async inference.\n"); return ret; } + async_module->thread_started = 1; + return 0; } diff --git a/libavfilter/dnn/dnn_backend_common.h b/libavfilter/dnn/dnn_backend_common.h index acb4256749..9cef469f6d 100644 --- a/libavfilter/dnn/dnn_backend_common.h +++ b/libavfilter/dnn/dnn_backend_common.h @@ -83,6 +83,7 @@ typedef struct DNNAsyncExecModule { */ void *args; pthread_t thread_id; + int thread_started; } DNNAsyncExecModule; int ff_check_exec_params(void *ctx, DNNBackendType backend, DNNFunctionType func_type, DNNExecBaseParams *exec_params); -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
