Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marton Balint <cus@passwd.hu>
To: ffmpeg-devel@ffmpeg.org
Cc: Marton Balint <cus@passwd.hu>
Subject: [FFmpeg-devel] [PATCH 2/4] avfilter/avfilter: add AVFilterGraph->max_buffered_frames to limit buffered frames
Date: Mon,  7 Jul 2025 00:00:02 +0200
Message-ID: <20250706220011.5799-2-cus@passwd.hu> (raw)
In-Reply-To: <20250706220011.5799-1-cus@passwd.hu>

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 doc/APIchanges              | 3 +++
 libavfilter/avfilter.h      | 8 ++++++++
 libavfilter/avfiltergraph.c | 4 ++++
 libavfilter/version.h       | 2 +-
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 9c03e541fd..797879f769 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
 
 API changes, most recent first:
 
+2025-07-xx - xxxxxxxxxd - lavfi 11.2.100 - avfilter.h
+  Add AVFilterGraph->max_buffered_frames.
+
 2025-07-01 - 39d5a998bd - lavc 62.4.101 - packet.h
   Add AV_PKT_DATA_3D_REFERENCE_DISPLAYS.
 
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index f85929dc5c..d2571b1404 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -629,6 +629,14 @@ typedef struct AVFilterGraph {
     avfilter_execute_func *execute;
 
     char *aresample_swr_opts; ///< swr options to use for the auto-inserted aresample filters, Access ONLY through AVOptions
+
+    /**
+     * Sets the maximum number of buffered frames in the filtergraph combined.
+     *
+     * Zero means no limit. This field must be set before calling
+     * avfilter_graph_config().
+     */
+    unsigned max_buffered_frames;
 } AVFilterGraph;
 
 /**
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 38b89db22a..86da0b9975 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -56,6 +56,8 @@ static const AVOption filtergraph_options[] = {
         AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, F|V },
     {"aresample_swr_opts"   , "default aresample filter options"    , OFFSET(aresample_swr_opts)    ,
         AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, F|A },
+    {"max_buffered_frames"  , "maximum number of buffered frames allowed", OFFSET(max_buffered_frames),
+        AV_OPT_TYPE_UINT,   {.i64 = 0}, 0, UINT_MAX, F|V|A },
     { NULL },
 };
 
@@ -1296,6 +1298,8 @@ int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
 {
     int ret;
 
+    if (graphctx->max_buffered_frames)
+        fffiltergraph(graphctx)->frame_queues.max_queued = graphctx->max_buffered_frames;
     if ((ret = graph_check_validity(graphctx, log_ctx)))
         return ret;
     if ((ret = graph_config_formats(graphctx, log_ctx)))
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 1e884d9b44..bece922c7f 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@
 
 #include "version_major.h"
 
-#define LIBAVFILTER_VERSION_MINOR   1
+#define LIBAVFILTER_VERSION_MINOR   2
 #define LIBAVFILTER_VERSION_MICRO 100
 
 
-- 
2.43.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2025-07-06 22:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-06 22:00 [FFmpeg-devel] [PATCH 1/4] avfilter/framequeue: add support for limiting and tracking buffered frames in the queues Marton Balint
2025-07-06 22:00 ` Marton Balint [this message]
2025-07-06 22:00 ` [FFmpeg-devel] [PATCH 3/4] fftools/ffmpeg: add support for setting maximum buffered frames in a filtergraph Marton Balint
2025-07-06 22:00 ` [FFmpeg-devel] [PATCH 4/4] tests/fate: add fate test for excessive frame buffering when using filters Marton Balint

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250706220011.5799-2-cus@passwd.hu \
    --to=cus@passwd.hu \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git