diff options
author | Marton Balint <[email protected]> | 2025-06-22 15:50:21 +0200 |
---|---|---|
committer | Marton Balint <[email protected]> | 2025-07-03 21:41:54 +0200 |
commit | d41bac1333b0a9ab621922a3e306ca455ff3b9a3 (patch) | |
tree | 1440a151d1f2647c9fc406fa308e8b70a264814b | |
parent | eea6f0e32e195f9ee851266e569b8a2fa9914ef1 (diff) |
avfilter: signal an empty buffersrc with an explicit activate error code
No change in functionality.
Signed-off-by: Marton Balint <[email protected]>
-rw-r--r-- | libavfilter/avfiltergraph.c | 2 | ||||
-rw-r--r-- | libavfilter/buffersink.c | 5 | ||||
-rw-r--r-- | libavfilter/buffersrc.c | 4 | ||||
-rw-r--r-- | libavfilter/filters.h | 1 |
4 files changed, 9 insertions, 3 deletions
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 2d6036df74..38b89db22a 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -1460,6 +1460,8 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) frame_count = oldesti->l.frame_count_out; while (frame_count == oldesti->l.frame_count_out) { r = ff_filter_graph_run_once(graph); + if (r == FFERROR_BUFFERSRC_EMPTY) + r = 0; if (r == AVERROR(EAGAIN) && !oldesti->frame_wanted_out && !oldesti->frame_blocked_in && !oldesti->status_in) diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 5cd47ba69f..fb33ad59c5 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -131,8 +131,11 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i return AVERROR(EAGAIN); } else if (li->frame_wanted_out) { ret = ff_filter_graph_run_once(ctx->graph); - if (ret < 0) + if (ret == FFERROR_BUFFERSRC_EMPTY) { + // Do nothing for now... + } else if (ret < 0) { return ret; + } } else { ff_inlink_request_frame(inlink); } diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c index af27306b3b..7e86d6ffd3 100644 --- a/libavfilter/buffersrc.c +++ b/libavfilter/buffersrc.c @@ -195,7 +195,7 @@ static int push_frame(AVFilterGraph *graph) ret = ff_filter_graph_run_once(graph); if (ret == AVERROR(EAGAIN)) break; - if (ret < 0) + if (ret < 0 && ret != FFERROR_BUFFERSRC_EMPTY) return ret; } return 0; @@ -552,7 +552,7 @@ static int activate(AVFilterContext *ctx) return 0; } c->nb_failed_requests++; - return FFERROR_NOT_READY; + return FFERROR_BUFFERSRC_EMPTY; } static const AVFilterPad avfilter_vsrc_buffer_outputs[] = { diff --git a/libavfilter/filters.h b/libavfilter/filters.h index e3013eda65..11152cfabf 100644 --- a/libavfilter/filters.h +++ b/libavfilter/filters.h @@ -31,6 +31,7 @@ * Special return code when activate() did not do anything. */ #define FFERROR_NOT_READY FFERRTAG('N','R','D','Y') +#define FFERROR_BUFFERSRC_EMPTY FFERRTAG('M','P','T','Y') /** * A filter pad used for either input or output. |