[vlc-devel] h264: Fix #6539

Rafaël Carré funman at videolan.org
Thu Jun 7 18:35:00 CEST 2012


Hello,

Le 07/06/2012 12:13, Aurélien Nephtali a écrit :
> On Thu, Jun 7, 2012 at 5:06 PM, Aurélien Nephtali
> <aurelien.nephtali at gmail.com> wrote:
>> > Hi,
>> >
>> > See attached patch.
>> >
>> > Thanks.
>> >
> New patch with correct indentation.
> 
> -- Aurélien Nephtali
> 
> 
> 0002-h264-Fix-6539.patch
> 
> 
> From 75d3642ea7ed63a0e71f1ac438082fa700a584d6 Mon Sep 17 00:00:00 2001
> From: Aurelien Nephtali <aurelien.nephtali at gmail.com>
> Date: Thu, 7 Jun 2012 18:11:39 +0200
> Subject: [PATCH 2/2] h264: Fix #6539
> 
> It is a very naive approach : if we have an AUD and no PTS to use we use the previous one
> No side effect so far.
> ---
>  modules/packetizer/h264.c |   18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
> index a680454..ed8a7b9 100644
> --- a/modules/packetizer/h264.c
> +++ b/modules/packetizer/h264.c
> @@ -122,6 +122,8 @@ struct decoder_sys_t
>      /* */
>      mtime_t i_frame_pts;
>      mtime_t i_frame_dts;
> +    mtime_t i_last_frame_pts;
> +    mtime_t i_last_frame_dts;
>  
>      /* */
>      uint32_t i_cc_flags;
> @@ -233,6 +235,8 @@ static int Open( vlc_object_t *p_this )
>  
>      p_sys->i_frame_dts = VLC_TS_INVALID;
>      p_sys->i_frame_pts = VLC_TS_INVALID;
> +    p_sys->i_last_frame_dts = VLC_TS_INVALID;
> +    p_sys->i_last_frame_pts = VLC_TS_INVALID;
>  
>      /* Setup properties */
>      es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
> @@ -516,6 +520,8 @@ static void PacketizeReset( void *p_private, bool b_broken )
>      }
>      p_sys->i_frame_pts = VLC_TS_INVALID;
>      p_sys->i_frame_dts = VLC_TS_INVALID;
> +    p_sys->i_last_frame_pts = VLC_TS_INVALID;
> +    p_sys->i_last_frame_dts = VLC_TS_INVALID;
>  }
>  static block_t *PacketizeParse( void *p_private, bool *pb_ts_used, block_t *p_block )
>  {
> @@ -610,8 +616,8 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
>  
>      const int i_nal_ref_idc = (p_frag->p_buffer[4] >> 5)&0x03;
>      const int i_nal_type = p_frag->p_buffer[4]&0x1f;
> -    const mtime_t i_frag_dts = p_frag->i_dts;
> -    const mtime_t i_frag_pts = p_frag->i_pts;
> +    /* const */ mtime_t i_frag_dts = p_frag->i_dts;
> +    /* const */ mtime_t i_frag_pts = p_frag->i_pts;

Please remove the const, there is no point in keeping it commented
because it can only cause confusion to the reader.

>  
>      if( p_sys->b_slice && ( !p_sys->b_sps || !p_sys->b_pps ) )
>      {
> @@ -684,6 +690,12 @@ static block_t *ParseNALBlock( decoder_t *p_dec, bool *pb_used_ts, block_t *p_fr
>          }
>          else if( i_nal_type == NAL_AU_DELIMITER )
>          {
> +            if( i_frag_pts <= VLC_TS_INVALID )
> +            {
> +                i_frag_dts = p_sys->i_last_frame_dts;
> +                i_frag_pts = p_sys->i_last_frame_pts;
> +            }

Reading the ticket I am not sure how:

AUD
SEI
SLICE
AUD
SEI
SLICE

is packetized:

2 packets containing AUD+SEI+SLICE, but have the same pts/dts ?

>              if( p_sys->p_frame && (p_sys->p_frame->i_flags & BLOCK_FLAG_PRIVATE_AUD) )
>              {
>                  block_Release( p_frag );
> @@ -778,6 +790,8 @@ static block_t *OutputPicture( decoder_t *p_dec )
>  
>      p_sys->slice.i_frame_type = 0;
>      p_sys->p_frame = NULL;
> +    p_sys->i_last_frame_dts = p_sys->i_frame_dts;
> +    p_sys->i_last_frame_pts = p_sys->i_frame_pts;
>      p_sys->i_frame_dts = VLC_TS_INVALID;
>      p_sys->i_frame_pts = VLC_TS_INVALID;
>      p_sys->b_frame_sps = false;



More information about the vlc-devel mailing list