]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/sr: process and output message when load_model is NULL
authorSteven Liu <lq@chinaffmpeg.org>
Mon, 24 Sep 2018 14:02:54 +0000 (22:02 +0800)
committerSteven Liu <lq@chinaffmpeg.org>
Mon, 24 Sep 2018 14:02:54 +0000 (22:02 +0800)
fix ticket: 7455

Reviewed-by: Pedro Arthur <bygrandao@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
libavfilter/dnn_interface.c
libavfilter/vf_sr.c

index 78d7c5cf222d2e1e603debd64f20b56f7710652c..86fc2830246f5cbe3e509fdbc75af3f43b9eb68d 100644 (file)
@@ -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;
index 077ccc799caaba07657035ab2702ea8db7c17105..6423d2ea118bc6ebd75c3105185b5d9444b6c122 100644 (file)
@@ -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");