From 2a351f6c5521c199b4285e4e42f2321e312170bd Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Tue, 25 Aug 2015 20:33:48 +0200 Subject: lavfi: drop the requirement that request_frame returns a frame. It requires a loop in filters or the framework, that makes the scheduling less efficient and more complex. This is purely an internal change since the loop is now present in buffersink. Note that no filter except buffersink did rely on the requirement. --- libavfilter/avfilter.c | 10 +--------- libavfilter/avfilter.h | 6 ------ libavfilter/internal.h | 13 ++++++++----- 3 files changed, 9 insertions(+), 20 deletions(-) (limited to 'libavfilter') diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 7da6cf2643..b9fadb3d59 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -347,9 +347,7 @@ int ff_request_frame(AVFilterLink *link) if (link->closed) return AVERROR_EOF; - av_assert0(!link->frame_requested); - link->frame_requested = 1; - while (link->frame_requested) { + // TODO reindent if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); else if (link->src->inputs[0]) @@ -360,14 +358,9 @@ int ff_request_frame(AVFilterLink *link) ret = ff_filter_frame_framed(link, pbuf); } if (ret < 0) { - link->frame_requested = 0; if (ret == AVERROR_EOF) link->closed = 1; - } else { - av_assert0(!link->frame_requested || - link->flags & FF_LINK_FLAG_REQUEST_LOOP); } - } return ret; } @@ -1088,7 +1081,6 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) } ret = filter_frame(link, out); link->frame_count++; - link->frame_requested = 0; ff_update_link_current_pts(link, pts); return ret; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 642aa834ab..5d4cd6ce12 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -499,12 +499,6 @@ struct AVFilterLink { */ int channels; - /** - * True if a frame is being requested on the link. - * Used internally by the framework. - */ - unsigned frame_requested; - /** * Link processing flags. */ diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 7816654010..1454112433 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -102,9 +102,9 @@ struct AVFilterPad { int (*poll_frame)(AVFilterLink *link); /** - * Frame request callback. A call to this should result in at least one - * frame being output over the given link. This should return zero on - * success, and another value on error. + * Frame request callback. A call to this should result in some progress + * towards producing output over the given link. This should return zero + * on success, and another value on error. * * Output pads only. */ @@ -291,8 +291,11 @@ int ff_poll_frame(AVFilterLink *link); * caller (generally eventually a user application) as this step may (but does * not have to be) necessary to provide the input with the next frame. * - * If a request is successful then the filter_frame() function will be called - * at least once before ff_request_frame() returns + * If a request is successful then some progress has been made towards + * providing a frame on the link (through ff_filter_frame()). A filter that + * needs several frames to produce one is allowed to return success if one + * more frame has been processed but no output has been produced yet. A + * filter is also allowed to simply forward a success return value. * * @param link the input link * @return zero on success -- cgit v1.2.3