[FFmpeg-devel] [PATCH 1/2] ffmpeg: ignore EOF when pushing frames to filters.

Paul B Mahol onemda at gmail.com
Sun Jun 2 16:32:52 CEST 2013


On 6/2/13, Nicolas George <nicolas.george at normalesup.org> wrote:
> EOF is not a fatal condition, it is normally produced
> by a few filters.
>
> TODO: take it into account to avoid useless decoding.
>
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  ffmpeg.c |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

lgtm

>
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 886039b..c9ac577 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1623,6 +1623,8 @@ static int decode_audio(InputStream *ist, AVPacket
> *pkt, int *got_output)
>              f = decoded_frame;
>          err = av_buffersrc_add_frame_flags(ist->filters[i]->filter, f,
>                                       AV_BUFFERSRC_FLAG_PUSH);
> +        if (err == AVERROR_EOF)
> +            err = 0; /* ignore */
>          if (err < 0)
>              break;
>      }
> @@ -1726,7 +1728,9 @@ static int decode_video(InputStream *ist, AVPacket
> *pkt, int *got_output)
>          } else
>              f = decoded_frame;
>          ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, f,
> AV_BUFFERSRC_FLAG_PUSH);
> -        if (ret < 0) {
> +        if (ret == AVERROR_EOF) {
> +            ret = 0; /* ignore */
> +        } else if (ret < 0) {
>              av_log(NULL, AV_LOG_FATAL,
>                     "Failed to inject frame into filter network: %s\n",
> av_err2str(ret));
>              exit(1);
> --
> 1.7.10.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list