aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/buffersink.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2025-06-22 16:28:44 +0200
committerMarton Balint <cus@passwd.hu>2025-07-03 21:41:54 +0200
commit223c2b03da1b13ac6b510135e4dc7cbe6fc8bea2 (patch)
treecdb4d093e891917cdf4ed4e7908870df8b6394c9 /libavfilter/buffersink.c
parentd41bac1333b0a9ab621922a3e306ca455ff3b9a3 (diff)
downloadffmpeg-223c2b03da1b13ac6b510135e4dc7cbe6fc8bea2.tar.gz
avfilter/buffersink: keep requesting frames if one activation of the graph does not provide one
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>
Diffstat (limited to 'libavfilter/buffersink.c')
-rw-r--r--libavfilter/buffersink.c7
1 files changed, 6 insertions, 1 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;
}