[FFmpeg-cvslog] lavfi: issue error if maximum number of filters is reached

Stefano Sabatini git at videolan.org
Sat Nov 5 02:18:56 CET 2011


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Nov  2 22:08:28 2011 +0100| [217790871e7d8f2e9690fbe785d29683e7f9ab23] | committer: Stefano Sabatini

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.

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

 libavfilter/avfilter.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index c1b7c43..d5f0c4b 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -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;



More information about the ffmpeg-cvslog mailing list