1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avfilter/dnn_backend_openvino: wait only for the inference requests that were created

Fixes: nC3u8khGyx61
Fixes: hang on teardown
Hang on teardown Replicated through UnModified FFmpeg with gdb
Hang on teardown Replicated through UnModified FFmpeg with gdb, a crafted 10240x10240 PNG, input_resizable=1 and vm.overcommit_memory=2
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24617
This commit is contained in:
Michael Niedermayer
2026-10-13 06:10:50 +02:00
committed by michaelni
parent 43f200e077
commit 33ac0ca199

View File

@@ -62,6 +62,7 @@ typedef struct OVModel{
Queue *task_queue; // holds TaskItem
Queue *lltask_queue; // holds LastLevelTaskItem
int nb_outputs;
int nb_requests;
} OVModel;
// one request for one call to openvino
@@ -516,7 +517,7 @@ static void dnn_free_model_ov(DNNModel **model)
return;
ov_model = (OVModel *)(*model);
ff_dnn_wait_requests(ov_model->request_queue, ov_model->ctx->nireq);
ff_dnn_wait_requests(ov_model->request_queue, ov_model->nb_requests);
while (ff_safe_queue_size(ov_model->request_queue) != 0) {
OVRequestItem *item = ff_safe_queue_pop_front(ov_model->request_queue);
if (item && item->infer_request) {
@@ -910,6 +911,7 @@ static int init_model_ov(OVModel *ov_model, const char *input_name, const char *
ret = AVERROR(ENOMEM);
goto err;
}
ov_model->nb_requests++;
#if HAVE_OPENVINO2
status = ov_compiled_model_create_infer_request(ov_model->compiled_model, &item->infer_request);