[FFmpeg-devel] [PATCH] avfilter/decode: do not treat discarded frames as eof when draining

Muhammad Faiz mfcc64 at gmail.com
Sun Apr 30 10:03:12 EEST 2017


On Sun, Apr 30, 2017 at 12:50 PM, Muhammad Faiz <mfcc64 at gmail.com> wrote:
> Fix fate failures:
>   make fate-mov THREADS=32
>
> Signed-off-by: Muhammad Faiz <mfcc64 at gmail.com>
> ---
>  libavcodec/decode.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index edfae55..6ec423b 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -557,9 +557,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          avci->showed_multi_packet_warning = 1;
>      }
>
> -    if (!got_frame)
> -        av_frame_unref(frame);
> -
>      if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED))
>          ret = pkt->size;
>
> @@ -568,8 +565,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
>  #endif
>
> -    /* do not stop draining when got_frame != 0 or ret < 0 */
> -    if (avctx->internal->draining && !got_frame) {
> +    /* do not stop draining when frame->buf[0] != NULL or ret < 0 */
> +    /* at this point, got_frame == 0 when discarding frame */
> +    if (avctx->internal->draining && !frame->buf[0]) {
>          if (ret < 0) {
>              /* prevent infinite loop if a decoder wrongly always return error on draining */
>              /* reasonable nb_errors_max = maximum b frames + thread count */
> @@ -603,7 +601,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>          avci->last_pkt_props->dts = AV_NOPTS_VALUE;
>      }
>
> -    if (got_frame)
> +    if (!got_frame)
> +        av_frame_unref(frame);
> +    else
>          av_assert0(frame->buf[0]);
>
>      return ret < 0 ? ret : 0;
> --
> 2.9.3
>

I'm sorry, typo in the subject.


More information about the ffmpeg-devel mailing list