[FFmpeg-devel] [PATCH]lavfi/avfiltergraph: Do not return ENOMEM if filter is missing

Nicolas George george at nsup.org
Mon Feb 5 17:22:50 EET 2018

James Almer (2018-02-04):
> -1 is not acceptable for a public function that states it returns an
> AVERROR value on failure.
> If the issue is that avfilter_graph_alloc_filter() may fail because of
> both OOM and an invalid value for filter, then I'm more inclined to use
> AVERROR_UNKNOWN here instead.

Sounds reasonable.

> That being said, based on the above the return value of
> avfilter_graph_alloc_filter() should have never been an AVFilterContext,
> but an int instead.
> Maybe a new function that returns a proper AVERROR value should be
> whatever corresponds depending on the type of failure.

I agree.

In fact, would you support me if I propose to add the following policy:?

	Any new function av_something_alloc() should have an API:

	ret = av_something_alloc(&ptr, params);

	and not:

	ptr = av_something_alloc(params);

even if it can, for the time being, only return AVERROR(ENOMEM).


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180205/42958f2e/attachment.sig>

More information about the ffmpeg-devel mailing list