On Fri, Oct 28, 2011 at 07:13:33AM -0700, Ronald S. Bultje wrote:
> Hi,
> 
> This fixes false positives of has_codec_delay_been_guessed() for
> streams where not every input picture generates an output picture,
> such as interlaced H264.
> 
> Fixes 3 samples from the conformance suite without requiring
> -std_compliance strict (which I'd like to kill):
> MAIN/CVFI2_Sony_H.jsv
> MAIN/CVNLFI2_Sony_H.jsv
> FREXT/HVLCFI0_Sony_B/HVLCFI0_Sony_B.264
> 
> Ronald

> From cec5d82e3db24ac3d9f41146af7c9009523cfee6 Mon Sep 17 00:00:00 2001
> From: Ronald S. Bultje <[email protected]>
> Date: Thu, 27 Oct 2011 20:37:34 -0700
> Subject: [PATCH] lavf: use number of output pictures for delay checks.
> 
> This fixes false positives of has_codec_delay_been_guessed() for
> streams where not every input picture generates an output picture,
> such as interlaced H264.
> ---
>  libavformat/avformat.h |    5 +++++
>  libavformat/utils.c    |    4 +++-
>  2 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 1b67ee6..1df54be 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -630,6 +630,11 @@ typedef struct AVStream {
>      int codec_info_nb_frames;
>  
>      /**
> +     * Number of frames that have been returned during try_decode_frame()
> +     */
> +    int codec_info_nb_decoded_frames;

is this a useful info for AVStream? can/should it used somewhere else?

> +
> +    /**
>       * Stream informations used internally by av_find_stream_info()
>       */
>  #define MAX_STD_TIMEBASES (60*12+5)
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 640fa70..67748a1 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -2080,7 +2080,7 @@ static int has_codec_parameters(AVCodecContext *avctx)
>  static int has_decode_delay_been_guessed(AVStream *st)
>  {
>      return st->codec->codec_id != CODEC_ID_H264 ||
> -        st->codec_info_nb_frames >= 6 + st->codec->has_b_frames;
> +        st->codec_info_nb_decoded_frames >= 6;
>  }
>  
>  static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary 
> **options)
> @@ -2106,6 +2106,8 @@ static int try_decode_frame(AVStream *st, AVPacket 
> *avpkt, AVDictionary **option
>              avcodec_get_frame_defaults(&picture);
>              ret = avcodec_decode_video2(st->codec, &picture,
>                                          &got_picture, avpkt);
> +            if (got_picture)
> +                st->codec_info_nb_decoded_frames++;

since has_decode_delay_been_guessed() is only used from try_decode_frame
it would be easier and less api polluting to use a local variable passed
to has_decode_delay_been_guessed.

otherwise ok

Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to