[FFmpeg-cvslog] avfilter/sr: process and output message when load_model is NULL

Steven Liu git at videolan.org
Mon Sep 24 17:04:07 EEST 2018


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Mon Sep 24 22:02:54 2018 +0800| [4b0033220361a6b61454da84f8bdf7f801ceda52] | committer: Steven Liu

avfilter/sr: process and output message when load_model is NULL

fix ticket: 7455

Reviewed-by: Pedro Arthur <bygrandao at gmail.com>
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b0033220361a6b61454da84f8bdf7f801ceda52
---

 libavfilter/dnn_interface.c | 5 +++++
 libavfilter/vf_sr.c         | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavfilter/dnn_interface.c b/libavfilter/dnn_interface.c
index 78d7c5cf22..86fc283024 100644
--- a/libavfilter/dnn_interface.c
+++ b/libavfilter/dnn_interface.c
@@ -52,6 +52,11 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type)
         av_freep(&dnn_module);
         return NULL;
     #endif
+        break;
+    default:
+        av_log(NULL, AV_LOG_ERROR, "Module backend_type is not native or tensorflow\n");
+        av_freep(&dnn_module);
+        return NULL;
     }
 
     return dnn_module;
diff --git a/libavfilter/vf_sr.c b/libavfilter/vf_sr.c
index 077ccc799c..6423d2ea11 100644
--- a/libavfilter/vf_sr.c
+++ b/libavfilter/vf_sr.c
@@ -75,7 +75,12 @@ static av_cold int init(AVFilterContext *context)
         return AVERROR(EIO);
     }
     else{
-        sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename);
+        if (!sr_context->dnn_module->load_model) {
+            av_log(context, AV_LOG_ERROR, "load_model for network was not specified\n");
+            return AVERROR(EIO);
+        } else {
+            sr_context->model = (sr_context->dnn_module->load_model)(sr_context->model_filename);
+        }
     }
     if (!sr_context->model){
         av_log(context, AV_LOG_ERROR, "could not load DNN model\n");



More information about the ffmpeg-cvslog mailing list