1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avfilter: signal an empty buffersrc with an explicit activate error code

No change in functionality.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint
2025-06-22 15:50:21 +02:00
parent eea6f0e32e
commit d41bac1333
4 changed files with 9 additions and 3 deletions

View File

@ -1460,6 +1460,8 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph)
frame_count = oldesti->l.frame_count_out; frame_count = oldesti->l.frame_count_out;
while (frame_count == oldesti->l.frame_count_out) { while (frame_count == oldesti->l.frame_count_out) {
r = ff_filter_graph_run_once(graph); r = ff_filter_graph_run_once(graph);
if (r == FFERROR_BUFFERSRC_EMPTY)
r = 0;
if (r == AVERROR(EAGAIN) && if (r == AVERROR(EAGAIN) &&
!oldesti->frame_wanted_out && !oldesti->frame_blocked_in && !oldesti->frame_wanted_out && !oldesti->frame_blocked_in &&
!oldesti->status_in) !oldesti->status_in)

View File

@ -131,8 +131,11 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
} else if (li->frame_wanted_out) { } else if (li->frame_wanted_out) {
ret = ff_filter_graph_run_once(ctx->graph); 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; return ret;
}
} else { } else {
ff_inlink_request_frame(inlink); ff_inlink_request_frame(inlink);
} }

View File

@ -195,7 +195,7 @@ static int push_frame(AVFilterGraph *graph)
ret = ff_filter_graph_run_once(graph); ret = ff_filter_graph_run_once(graph);
if (ret == AVERROR(EAGAIN)) if (ret == AVERROR(EAGAIN))
break; break;
if (ret < 0) if (ret < 0 && ret != FFERROR_BUFFERSRC_EMPTY)
return ret; return ret;
} }
return 0; return 0;
@ -552,7 +552,7 @@ static int activate(AVFilterContext *ctx)
return 0; return 0;
} }
c->nb_failed_requests++; c->nb_failed_requests++;
return FFERROR_NOT_READY; return FFERROR_BUFFERSRC_EMPTY;
} }
static const AVFilterPad avfilter_vsrc_buffer_outputs[] = { static const AVFilterPad avfilter_vsrc_buffer_outputs[] = {

View File

@ -31,6 +31,7 @@
* Special return code when activate() did not do anything. * Special return code when activate() did not do anything.
*/ */
#define FFERROR_NOT_READY FFERRTAG('N','R','D','Y') #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. * A filter pad used for either input or output.