[FFmpeg-devel] [PATCH] h264_parser: Fix behaviour when PARSER_FLAG_COMPLETE_FRAMES is set.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Mar 28 19:15:30 CEST 2011


On Sun, Mar 27, 2011 at 03:48:29PM -0700, Philip Langdale wrote:
> diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
> index c5728e2..7ae5d5a 100644
> --- a/libavcodec/h264_parser.c
> +++ b/libavcodec/h264_parser.c
> @@ -270,21 +270,22 @@ static int h264_parse(AVCodecParserContext *s,
>              assert(pc->last_index + next >= 0 );
>              ff_h264_find_frame_end(h, &pc->buffer[pc->last_index + next], -next); //update state
>          }
> +    }
>  
> -        parse_nal_units(s, avctx, buf, buf_size);
> +    parse_nal_units(s, avctx, buf, buf_size);
>  
> -        if (h->sei_cpb_removal_delay >= 0) {
> -            s->dts_sync_point    = h->sei_buffering_period_present;
> -            s->dts_ref_dts_delta = h->sei_cpb_removal_delay;
> -            s->pts_dts_delta     = h->sei_dpb_output_delay;
> -        } else {
> -            s->dts_sync_point    = INT_MIN;
> -            s->dts_ref_dts_delta = INT_MIN;
> -            s->pts_dts_delta     = INT_MIN;
> -        }
> -        if (s->flags & PARSER_FLAG_ONCE) {
> -            s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
> -        }
> +    if (h->sei_cpb_removal_delay >= 0) {
> +        s->dts_sync_point    = h->sei_buffering_period_present;
> +        s->dts_ref_dts_delta = h->sei_cpb_removal_delay;
> +        s->pts_dts_delta     = h->sei_dpb_output_delay;
> +    } else {
> +        s->dts_sync_point    = INT_MIN;
> +        s->dts_ref_dts_delta = INT_MIN;
> +        s->pts_dts_delta     = INT_MIN;
> +    }
> +
> +    if (s->flags & PARSER_FLAG_ONCE) {
> +        s->flags &= PARSER_FLAG_COMPLETE_FRAMES;
>      }

Please do the reindentation separately.
I also think PARSER_FLAG_ONCE doesn't quite do the right thing,
though I'm not really sure what it is supposed to do.


More information about the ffmpeg-devel mailing list