[FFmpeg-devel] [PATCH 2/3] lavfi/buffersink: loop until the sink fifo get filled.

Clément Bœsch ubitux at gmail.com
Sat Mar 16 16:51:13 CET 2013


On Sat, Mar 16, 2013 at 04:50:12PM +0100, Clément Bœsch wrote:
> In some situations, notably when there is a filter using the min/max
> samples (where some buffering is done), the ff_request_frame() present
> in that chunk could succeed without having filled the buffer sink fifo.
> 
> This fixes -f lavfi -i amovie=in.mp3,ebur128=metadata=1 where the first
> av_buffersink_get_frame_flags() led to a EINVAL.
> ---
>  libavfilter/buffersink.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c
> index 8236f22..087f845 100644
> --- a/libavfilter/buffersink.c
> +++ b/libavfilter/buffersink.c
> @@ -125,16 +125,13 @@ int av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flag
>      AVFrame *cur_frame;
>  
>      /* no picref available, fetch it from the filterchain */
> -    if (!av_fifo_size(buf->fifo)) {
> +    while (!av_fifo_size(buf->fifo)) {
>          if (flags & AV_BUFFERSINK_FLAG_NO_REQUEST)
>              return AVERROR(EAGAIN);
>          if ((ret = ff_request_frame(inlink)) < 0)
>              return ret;
>      }
>  
> -    if (!av_fifo_size(buf->fifo))
> -        return AVERROR(EINVAL);
> -
>      if (flags & AV_BUFFERSINK_FLAG_PEEK) {
>          cur_frame = *((AVFrame **)av_fifo_peek2(buf->fifo, 0));
>          av_frame_ref(frame, cur_frame); /* TODO check failure */

Note: this patch is related to what Nicolas is talking about in
http://ffmpeg.org/pipermail/ffmpeg-devel/2013-March/140636.html

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130316/0d68960e/attachment.asc>


More information about the ffmpeg-devel mailing list