From: Marton Balint <cus@passwd.hu> To: ffmpeg-devel@ffmpeg.org Cc: Marton Balint <cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 09/12] avfilter/buffersink: keep requesting frames if one activation of the graph does not provide one Date: Tue, 24 Jun 2025 21:23:07 +0200 Message-ID: <20250624192318.7430-9-cus@passwd.hu> (raw) In-Reply-To: <20250624192318.7430-1-cus@passwd.hu> A frame graph activation might not produce a frame in the requested sink, so keep on requesting a frame there unless we encounter a filter activation with buffersrc empty error. This makes av_buffersink_get_frame(_flags) work according to its documentation which claims that EAGAIN is only returned if additional frames must be inserted into the graph. Fate changes are because audio frames will have different sizes at segment boundaries, but content is the same. Signed-off-by: Marton Balint <cus@passwd.hu> --- libavfilter/buffersink.c | 7 ++++++- tests/ref/fate/filter-asegment-samples-absolute | 6 ++++-- tests/ref/fate/filter-asegment-samples-relative | 6 ++++-- tests/ref/fate/filter-asegment-timestamps-absolute | 3 ++- tests/ref/fate/filter-asegment-timestamps-relative | 3 ++- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index fb33ad59c5..50a7da2756 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -113,6 +113,7 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i int status, ret; AVFrame *cur_frame; int64_t pts; + int buffersrc_empty = 0; if (buf->peeked_frame) return return_or_keep_frame(buf, frame, buf->peeked_frame, flags); @@ -132,7 +133,11 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i } else if (li->frame_wanted_out) { ret = ff_filter_graph_run_once(ctx->graph); if (ret == FFERROR_BUFFERSRC_EMPTY) { - // Do nothing for now... + buffersrc_empty = 1; + } else if (ret == AVERROR(EAGAIN)) { + if (buffersrc_empty) + return ret; + ff_inlink_request_frame(inlink); } else if (ret < 0) { return ret; } diff --git a/tests/ref/fate/filter-asegment-samples-absolute b/tests/ref/fate/filter-asegment-samples-absolute index 4090459aa7..ba9e9e269a 100644 --- a/tests/ref/fate/filter-asegment-samples-absolute +++ b/tests/ref/fate/filter-asegment-samples-absolute @@ -16,9 +16,11 @@ 0, 0, 0, 4096, 16384, 0x02ebe66b 0, 4096, 4096, 4096, 16384, 0x35bfe081 0, 8192, 8192, 1808, 7232, 0xa585202c -1, 10000, 10000, 6384, 25536, 0x17309ccf +1, 10000, 10000, 2288, 9152, 0x319ac07d +1, 12288, 12288, 4096, 16384, 0xd389dc43 1, 16384, 16384, 3616, 14464, 0x67e82600 -2, 20000, 20000, 4576, 18304, 0x4bc89a8b +2, 20000, 20000, 480, 1920, 0x24bfb749 +2, 20480, 20480, 4096, 16384, 0x378ee333 2, 24576, 24576, 4096, 16384, 0xabf6df0f 2, 28672, 28672, 4096, 16384, 0xedefe76f 2, 32768, 32768, 4096, 16384, 0x02ebe66b diff --git a/tests/ref/fate/filter-asegment-samples-relative b/tests/ref/fate/filter-asegment-samples-relative index 4090459aa7..ba9e9e269a 100644 --- a/tests/ref/fate/filter-asegment-samples-relative +++ b/tests/ref/fate/filter-asegment-samples-relative @@ -16,9 +16,11 @@ 0, 0, 0, 4096, 16384, 0x02ebe66b 0, 4096, 4096, 4096, 16384, 0x35bfe081 0, 8192, 8192, 1808, 7232, 0xa585202c -1, 10000, 10000, 6384, 25536, 0x17309ccf +1, 10000, 10000, 2288, 9152, 0x319ac07d +1, 12288, 12288, 4096, 16384, 0xd389dc43 1, 16384, 16384, 3616, 14464, 0x67e82600 -2, 20000, 20000, 4576, 18304, 0x4bc89a8b +2, 20000, 20000, 480, 1920, 0x24bfb749 +2, 20480, 20480, 4096, 16384, 0x378ee333 2, 24576, 24576, 4096, 16384, 0xabf6df0f 2, 28672, 28672, 4096, 16384, 0xedefe76f 2, 32768, 32768, 4096, 16384, 0x02ebe66b diff --git a/tests/ref/fate/filter-asegment-timestamps-absolute b/tests/ref/fate/filter-asegment-timestamps-absolute index b3f72c958a..5807194fc8 100644 --- a/tests/ref/fate/filter-asegment-timestamps-absolute +++ b/tests/ref/fate/filter-asegment-timestamps-absolute @@ -24,7 +24,8 @@ 0, 32768, 32768, 4096, 16384, 0x02ebe66b 0, 36864, 36864, 4096, 16384, 0x35bfe081 0, 40960, 40960, 3140, 12560, 0x13b5698a -1, 44100, 44100, 5052, 20208, 0xadc32273 +1, 44100, 44100, 956, 3824, 0xee464a2f +1, 45056, 45056, 4096, 16384, 0xe92bd835 1, 49152, 49152, 4096, 16384, 0x1126dca3 1, 53248, 53248, 4096, 16384, 0x9647edcf 1, 57344, 57344, 4096, 16384, 0x5cc345aa diff --git a/tests/ref/fate/filter-asegment-timestamps-relative b/tests/ref/fate/filter-asegment-timestamps-relative index b3f72c958a..5807194fc8 100644 --- a/tests/ref/fate/filter-asegment-timestamps-relative +++ b/tests/ref/fate/filter-asegment-timestamps-relative @@ -24,7 +24,8 @@ 0, 32768, 32768, 4096, 16384, 0x02ebe66b 0, 36864, 36864, 4096, 16384, 0x35bfe081 0, 40960, 40960, 3140, 12560, 0x13b5698a -1, 44100, 44100, 5052, 20208, 0xadc32273 +1, 44100, 44100, 956, 3824, 0xee464a2f +1, 45056, 45056, 4096, 16384, 0xe92bd835 1, 49152, 49152, 4096, 16384, 0x1126dca3 1, 53248, 53248, 4096, 16384, 0x9647edcf 1, 57344, 57344, 4096, 16384, 0x5cc345aa -- 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".
next prev parent reply other threads:[~2025-06-24 19:25 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-06-24 19:22 [FFmpeg-devel] [PATCH 01/12] avfilter: factorize requesting an input frame from multi output filters Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 02/12] avfilter/filters: simplify FF_FILTER_FORWARD_WANTED_ANY Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 03/12] avfilter/avfilter: fix forwarding EOF for simple API filters in filter_activate_default Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 04/12] fate/filter-video: add ffprobe test for dual output select filter Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 05/12] avfilter/avfilter: always forward request frame in filter_activate_default Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 06/12] avfilter/avfilter: make filter_activate_default request frames on behalf of sinks Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 07/12] tests/fate/filter-audio: add anullsink test Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 08/12] avfilter: signal an empty buffersrc with an explicit activate error code Marton Balint 2025-06-24 19:23 ` Marton Balint [this message] 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 10/12] avfilter/f_select: port to activate Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 11/12] fftools/ffmpeg_filter: always reap all available frames before requesting new ones Marton Balint 2025-06-24 19:23 ` [FFmpeg-devel] [PATCH 12/12] avfilter/ffmpeg_filter: rate control all filter graphs 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=20250624192318.7430-9-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