[vlc-devel] [PATCH] input: rework delay handling

Thomas Guillem thomas at gllm.fr
Thu Jun 20 10:25:55 CEST 2019



On Wed, Jun 19, 2019, at 12:53, Thomas Guillem wrote:
> 
> 
> On Wed, Jun 19, 2019, at 11:59, Francois Cartegnie wrote:
> > Le 19/06/2019 à 11:40, Thomas Guillem a écrit :
> > 
> > > @@ -2755,20 +2777,20 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
> > >              if( b_late && ( !input_priv(p_sys->p_input)->p_sout ||
> > >                              !input_priv(p_sys->p_input)->b_out_pace_control ) )
> > >              {
> > > -                const vlc_tick_t i_pts_delay_base = p_sys->i_pts_delay - p_sys->i_pts_jitter;
> > >                  vlc_tick_t i_pts_delay = input_clock_GetJitter( p_pgrm->p_input_clock );
> > >  
> > >                  /* Avoid dangerously high value */
> > >                  const vlc_tick_t i_jitter_max =
> > >                          VLC_TICK_FROM_MS(var_InheritInteger( p_sys->p_input, "clock-jitter" ));
> > > -                if( i_pts_delay > __MIN( i_pts_delay_base + i_jitter_max, INPUT_PTS_DELAY_MAX ) )
> > > +                if( i_pts_delay > __MIN( p_sys->i_pts_delay + i_jitter_max, INPUT_PTS_DELAY_MAX ) )
> > >                  {
> > >                      es_out_pgrm_t *pgrm;
> > >  
> > >                      msg_Err( p_sys->p_input,
> > >                               "ES_OUT_SET_(GROUP_)PCR  is called too late (jitter of %d ms ignored)",
> > > -                             (int)MS_FROM_VLC_TICK(i_pts_delay - i_pts_delay_base) );
> > > -                    i_pts_delay = p_sys->i_pts_delay;
> > > +                             (int)MS_FROM_VLC_TICK(i_pts_delay - p_sys->i_pts_delay) );
> > > +                    i_pts_delay = p_sys->i_pts_delay + p_sys->i_pts_jitter
> > > +                                + p_sys->i_extra_pts_delay;
> > >
> > 
> > In my undertanding, this is breaking the jitter compensation
> > 
> > was
> > Current late delay mean > total delay - jitter + jitter_max
> > vs
> > Current late delay mean > total delay + jitter max + extra delay
> > 
> 
> before:
> pts_delay += extra_delay (calculated from input.c)
> p_sys->i_pts_delay = pts_delay + pts_jitter;
> p_sys->i_pts_jitter = pts_jitter;
> 
> Now 
> p_sys->i_pts_delay = pts_delay;
> p_sys->i_pts_jitter = pts_jitter;
> p_sys->i_extra_pts_delay = extra_delay;
> 
> So old p_sys->i_pts_delay is equivalent to new p_sys->i_pts_delay  + 
> p_sys->i_pts_jitter + p_sys->i_extra_pts_delay

I spoke with Francois in private, he missed the following diff:

-        p_sys->i_pts_delay  = i_pts_delay + i_pts_jitter;
+        p_sys->i_pts_delay  = i_pts_delay;

So he finally agreed (after I rename extra_delay to tracks_delay).

> 
> For me, this diff is then correct.
> 
> 
> > -- 
> > Francois Cartegnie
> > VideoLAN - VLC Developer
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list