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

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>
This commit is contained in:
Steven Liu 2018-09-24 22:02:54 +08:00
parent 8d29930767
commit 4b00332203
2 changed files with 11 additions and 1 deletions

View File

@ -52,6 +52,11 @@ DNNModule *ff_get_dnn_module(DNNBackendType backend_type)
av_freep(&dnn_module); av_freep(&dnn_module);
return NULL; return NULL;
#endif #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; return dnn_module;

View File

@ -75,7 +75,12 @@ static av_cold int init(AVFilterContext *context)
return AVERROR(EIO); return AVERROR(EIO);
} }
else{ 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){ if (!sr_context->model){
av_log(context, AV_LOG_ERROR, "could not load DNN model\n"); av_log(context, AV_LOG_ERROR, "could not load DNN model\n");