[FFmpeg-devel] [PATCH 3/3] vf_overlay: rewrite request/push logic.

Stefano Sabatini stefasab at gmail.com
Wed May 23 01:46:27 CEST 2012


On date Sunday 2012-05-20 21:26:15 +0200, Nicolas George encoded:
> The old implementation, upon receiving a frame on the main
> input, would request an overlay frame if necessary. This could
> generate an infinite recursion, off-by-one frame mismatch and
> other harmful effects, especially it the split filter is present
> upgraph.
> 
> The new implementation uses the linear approach: it uses two
> buffer queues for frames received out of turn and forwards
> request_frame calls to the input where a frame is necessary.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/vf_overlay.c |  225 +++++++++++++++++++++++++++++++---------------
>  1 file changed, 154 insertions(+), 71 deletions(-)
[...] 
> -static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
> +static int try_start_frame(AVFilterContext *ctx, AVFilterBufferRef *mainpic)
>  {
> -    AVFilterContext *ctx = inlink->dst;
> +    OverlayContext *over = ctx->priv;
> +    AVFilterLink *outlink = ctx->outputs[0];

> +    AVFilterBufferRef *next_overpic, *outpicref;

nit++: outpicref -> outpic for local consistency

> +

> +    /* Discard obsolete overlay frames: if there is a next frame with pts is
> +     * before the main frame, we can drop the current overlay. */

"with pts is" at the end of the first line seems spurios

[...]

Looks good otherwise after *many* readings, although I think it's
complex enough so I can't catch subtle errors, so should be OK if
reasonably tested, thanks.
-- 
FFmpeg = Fiendish & Foolish Martial Portentous Eccentric Glue


More information about the ffmpeg-devel mailing list