[vlc-devel] [vlc-commits] packetizer: h264: set duration also using frame rate

Filip Roséen filip at atch.se
Wed Mar 22 14:32:04 CET 2017


Hi Francois,

On 2017-03-22 12:17, Francois Cartegnie wrote:

> packetizer: h264: set duration also using frame rate
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=98e83f7796b56960ad916f6ab76b5b4dd591ce90
> ---
> 
>  modules/packetizer/h264.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
> index 043e3ce..b0496c5 100644
> --- a/modules/packetizer/h264.c
> +++ b/modules/packetizer/h264.c
> @@ -764,12 +764,6 @@ static block_t *OutputPicture( decoder_t *p_dec )
>          }
>      }
>  
> -    if( p_sps->vui.i_time_scale && p_pic->i_length == 0 )
> -    {
> -        p_pic->i_length = CLOCK_FREQ * i_num_clock_ts *
> -                          p_sps->vui.i_num_units_in_tick / p_sps->vui.i_time_scale;
> -    }
> -
>      if( p_sps->frame_mbs_only_flag == 0 && p_sps->vui.b_pic_struct_present_flag )
>      {
>          switch( p_sys->i_pic_struct )
> @@ -849,6 +843,21 @@ static block_t *OutputPicture( decoder_t *p_dec )
>          p_sys->prevdatedpoc.num = PictureOrderCount;
>      }
>  
> +    if( p_pic->i_length == 0 )
> +    {
> +        if( p_sps->vui.i_time_scale )
> +        {
> +            p_pic->i_length = CLOCK_FREQ * i_num_clock_ts *
> +                              p_sps->vui.i_num_units_in_tick / p_sps->vui.i_time_scale;

I cannot see how the above is valid if `p_sps->vui.b_fixed_frame_rate
== 0`, as such I propose the attached patch as a fixup. I would
however be happy to stand corrected as learning something new is
always welcomed.

As a disclaimer my knowledge of `h264` is solely based on reading the
patches that get merged into the codebase, so I am by definition out
on very thin ice when it comes to corrections. In other words, I
apologize if the stated is so inaccurate that a someone with more
extensive knowledge would have a tear running down their cheek.

> +        }
> +        else
> +        {
> +            date_t next = p_sys->dts;
> +            date_Increment( &next, i_num_clock_ts );
> +            p_pic->i_length = date_Get( &next ) - date_Get( &p_sys->dts );
> +        }
> +    }
> +
>  #if 0
>      msg_Err(p_dec, "F/BOC %d/%d POC %d %s ref%d fn %d fp %d %d pts %ld",
>                      tFOC, bFOC, PictureOrderCount,

Best Regards,\
Filip Roséen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170322/6d33a2f7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-packetizer-h264-OutputPicture-fix-frame-length-calcu.patch
Type: text/x-diff
Size: 1113 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170322/6d33a2f7/attachment.patch>


More information about the vlc-devel mailing list