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

Submitted by Muhammad Faiz on April 30, 2017, 5:50 a.m.

Details

Message ID 20170430055012.22743-1-mfcc64@gmail.com
State New
Headers show

Commit Message

Muhammad Faiz April 30, 2017, 5:50 a.m.
Fix fate failures:
  make fate-mov THREADS=32

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
---
 libavcodec/decode.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Muhammad Faiz April 30, 2017, 7:03 a.m.
On Sun, Apr 30, 2017 at 12:50 PM, Muhammad Faiz <mfcc64@gmail.com> wrote:
> Fix fate failures:
>   make fate-mov THREADS=32
>
> Signed-off-by: Muhammad Faiz <mfcc64@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.

Patch hide | download patch | download mbox

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;