Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 4/7] avfilter/avfilter: simplify processing sinks without activate callback
Date: Tue, 17 Jun 2025 00:56:23 +0200
Message-ID: <GV1P250MB07371451676B02FB5FEE76D98F70A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20250616224404.16142-4-cus@passwd.hu>

Marton Balint:
> Sinks without an activate callback (nullsink, anullsink) could cause
> AVERROR(EAGAIN)-s in avfilter_graph_request_oldest() even when all the filter
> graphs inputs were in EOF state.
> 
> Fixes ticket #11624.
> Fixes ticket #10988.
> Fixes ticket #10990.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavfilter/avfiltergraph.c | 38 ++++++++++++++++++-------------------
>  1 file changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
> index 2d6036df74..6f9f46f1ea 100644
> --- a/libavfilter/avfiltergraph.c
> +++ b/libavfilter/avfiltergraph.c
> @@ -1423,12 +1423,26 @@ void ff_avfilter_graph_update_heap(AVFilterGraph *graph, FilterLinkInternal *li)
>      heap_bubble_down(graphi, li, li->age_index);
>  }
>  
> +static int process_legacy_sink_output(FilterLinkInternal *oldesti)

Why is considered legacy (instead of being just a different API)?

> +{
> +    AVFilterLink *oldest = &oldesti->l.pub;
> +    int ret;
> +
> +    do {
> +        if (oldesti->frame_wanted_out)
> +            ret = ff_filter_graph_run_once(oldest->dst->graph);
> +        else
> +            ret = ff_request_frame(oldest);
> +    } while (ret >= 0);
> +
> +    return ret;
> +}
> +
>  int avfilter_graph_request_oldest(AVFilterGraph *graph)
>  {
>      FFFilterGraph *graphi = fffiltergraph(graph);
>      FilterLinkInternal *oldesti = graphi->sink_links[0];
>      AVFilterLink *oldest = &oldesti->l.pub;
> -    int64_t frame_count;
>      int r;
>  
>      while (graphi->sink_links_count) {
> @@ -1437,13 +1451,11 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph)
>          if (fffilter(oldest->dst->filter)->activate) {
>              r = av_buffersink_get_frame_flags(oldest->dst, NULL,
>                                                AV_BUFFERSINK_FLAG_PEEK);
> -            if (r != AVERROR_EOF)
> -                return r;
>          } else {
> -            r = ff_request_frame(oldest);
> +            r = process_legacy_sink_output(oldesti);
>          }
>          if (r != AVERROR_EOF)
> -            break;
> +            return r;
>          av_log(oldest->dst, AV_LOG_DEBUG, "EOF on sink link %s:%s.\n",
>                 oldest->dst->name,
>                 oldest->dstpad->name);
> @@ -1453,21 +1465,7 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph)
>                               oldesti->age_index);
>          oldesti->age_index = -1;
>      }
> -    if (!graphi->sink_links_count)
> -        return AVERROR_EOF;
> -    av_assert1(!fffilter(oldest->dst->filter)->activate);
> -    av_assert1(oldesti->age_index >= 0);
> -    frame_count = oldesti->l.frame_count_out;
> -    while (frame_count == oldesti->l.frame_count_out) {
> -        r = ff_filter_graph_run_once(graph);
> -        if (r == AVERROR(EAGAIN) &&
> -            !oldesti->frame_wanted_out && !oldesti->frame_blocked_in &&
> -            !oldesti->status_in)
> -            (void)ff_request_frame(oldest);
> -        else if (r < 0)
> -            return r;
> -    }
> -    return 0;
> +    return AVERROR_EOF;
>  }
>  
>  int ff_filter_graph_run_once(AVFilterGraph *graph)

_______________________________________________
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-06-16 22:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16 22:43 [FFmpeg-devel] [PATCH 1/7] fftools/ffmpeg_filter: simplify control flow in read_frames Marton Balint
2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 2/7] avfilter/split: consume all frames before forwarding inlink status Marton Balint
2025-06-18 11:39   ` Nicolas George
2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 3/7] avfilter/f_select: port to activate Marton Balint
2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 4/7] avfilter/avfilter: simplify processing sinks without activate callback Marton Balint
2025-06-16 22:56   ` Andreas Rheinhardt [this message]
2025-06-16 23:02     ` Marton Balint
2025-06-16 23:54       ` Andreas Rheinhardt
2025-06-17 20:07         ` Marton Balint
2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 5/7] avfilter/af_aresample: merge request_frame into activate function Marton Balint
2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 6/7] avfilter/af_aresample: make aresample return FFERROR_NOT_READY when no progress can be made Marton Balint
2025-06-16 22:43 ` [FFmpeg-devel] [PATCH 7/7] avfilter/af_aresample: rework activate logic to follow the advised flow more strictly 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=GV1P250MB07371451676B02FB5FEE76D98F70A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --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