PR #22751 opened by tknaveen
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22751
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22751.patch

Add proper error checking for async inference execution, matching the pattern 
used by other DNN backends (TensorFlow, OpenVINO).
This ensures consistent error handling across all DNN backends when async 
inference fails.
That's accurate and doesn't name specific files. Want me to push this?


>From 55f671f5940b44af632b39f8a0ce758ae1366189 Mon Sep 17 00:00:00 2001
From: tknaveen <[email protected]>
Date: Sat, 4 Apr 2026 17:27:43 +0530
Subject: [PATCH 1/2] avfilter/vf_dnn_processing: fix torch backend AVOption
 unit

The torch backend option was missing .unit = "backend", causing it
to not be properly associated with the backend unit group.

Signed-off-by: Naveen <[email protected]>
---
 libavfilter/vf_dnn_processing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index 0771ceb5fc..5690cc5cd7 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -51,7 +51,7 @@ static const AVOption dnn_processing_options[] = {
     { "openvino",    "openvino backend flag",      0,                        
AV_OPT_TYPE_CONST,     { .i64 = DNN_OV },    0, 0, FLAGS, .unit = "backend" },
 #endif
 #if (CONFIG_LIBTORCH == 1)
-    { "torch",       "torch backend flag",         0,                        
AV_OPT_TYPE_CONST,     { .i64 = DNN_TH },    0, 0, FLAGS, "backend" },
+    { "torch",       "torch backend flag",         0,                        
AV_OPT_TYPE_CONST,     { .i64 = DNN_TH },    0, 0, FLAGS, .unit = "backend" },
 #endif
     { NULL }
 };
-- 
2.52.0


>From 346fe01607bafec48d6b5a1943a690371c3b6a53 Mon Sep 17 00:00:00 2001
From: tknaveen <[email protected]>
Date: Wed, 8 Apr 2026 20:07:59 +0530
Subject: [PATCH 2/2] avfilter/dnn_backend_torch: add error handling for async
 inference

Align with TensorFlow backend by adding proper error checking
after ff_dnn_start_inference_async() call.

Co-authored-by: tknaveen <[email protected]>
---
 libavfilter/dnn/dnn_backend_torch.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_torch.cpp 
b/libavfilter/dnn/dnn_backend_torch.cpp
index 24a202f493..6cd93fd136 100644
--- a/libavfilter/dnn/dnn_backend_torch.cpp
+++ b/libavfilter/dnn/dnn_backend_torch.cpp
@@ -342,7 +342,10 @@ static int execute_model_th(THRequestItem *request, Queue 
*lltask_queue)
     }
 
     if (task->async) {
-        return ff_dnn_start_inference_async(th_model->ctx, 
&request->exec_module);
+        if (ff_dnn_start_inference_async(th_model->ctx, &request->exec_module) 
!= 0) {
+            goto err;
+        }
+        return 0;
     } else {
         // Synchronous execution path
         ret = th_start_inference((void *)(request));
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to