lavfi: issue error if maximum number of filters is reached
Issue an error and return a more meaningful error code in case the maximum number of registered filters has been reached. This is better than silently ignore the error, improve feedback.
This commit is contained in:
parent
6ace8374ba
commit
217790871e
@ -706,8 +706,13 @@ AVFilter *avfilter_get_by_name(const char *name)
|
||||
|
||||
int avfilter_register(AVFilter *filter)
|
||||
{
|
||||
if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB)
|
||||
return -1;
|
||||
if (next_registered_avfilter_idx == MAX_REGISTERED_AVFILTERS_NB) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Maximum number of registered filters %d reached, "
|
||||
"impossible to register filter with name '%s'\n",
|
||||
MAX_REGISTERED_AVFILTERS_NB, filter->name);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
registered_avfilters[next_registered_avfilter_idx++] = filter;
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user