[vlc-devel] [PATCH] decoder: always rebase clock of pts only packets

Rémi Denis-Courmont remi at remlab.net
Mon Apr 23 20:45:43 CEST 2018


Le maanantaina 23. huhtikuuta 2018, 21.19.17 EEST Francois Cartegnie a écrit :
> In case of missing pts, the clock is not rebased to
> system clock which then breaks when mixed with other streams.
> 
> Ex: rtsp video has no pts, but audio has since this is dts.
> ---
>  src/input/decoder.c | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index 456b103935..16cf6c3ac2 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -781,6 +781,7 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t
> *pi_ts0, mtime_t *pi_ts1, const bool b_ephemere = pi_ts1 && *pi_ts0 ==
> *pi_ts1;
>      int i_rate;
> 
> +    int i_ret;
>      if( *pi_ts0 > VLC_TS_INVALID )
>      {
>          *pi_ts0 += i_es_delay;
> @@ -788,21 +789,33 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t
> *pi_ts0, mtime_t *pi_ts1, *pi_ts1 += i_es_delay;
>          if( i_ts_bound != INT64_MAX )
>              i_ts_bound += i_es_delay;
> -        if( input_clock_ConvertTS( VLC_OBJECT(p_dec), p_clock, &i_rate,
> pi_ts0, pi_ts1, i_ts_bound ) ) { -            const char *psz_name =
> module_get_name( p_dec->p_module, false ); -            if( pi_ts1 != NULL
> )
> -                msg_Err(p_dec, "Could not convert timestamps %"PRId64
> -                        ", %"PRId64" for %s", *pi_ts0, *pi_ts1, psz_name );
> -            else
> -                msg_Err(p_dec, "Could not convert timestamp %"PRId64" for
> %s", *pi_ts0, psz_name ); -            *pi_ts0 = VLC_TS_INVALID;
> -        }
> +        i_ret = input_clock_ConvertTS( VLC_OBJECT(p_dec), p_clock, &i_rate,
> pi_ts0, pi_ts1, i_ts_bound ); +    }
> +    else if( pi_ts1 && *pi_ts1 > VLC_TS_INVALID )
> +    {
> +        i_ret = input_clock_ConvertTS( VLC_OBJECT(p_dec), p_clock, &i_rate,
> pi_ts1, NULL, i_ts_bound ); }
>      else
>      {
> +        i_ret = 0;
>          i_rate = input_clock_GetRate( p_clock );
>      }
> 
> +    if( i_ret != 0 )
> +    {
> +        const char *psz_name = module_get_name( p_dec->p_module, false );

The logs should already state what is the module when it gets probed - just 
match the object ID.

Adding the module name manually just because it is convenient feels like a 
slippery slope to me.

> +        if( pi_ts1 != NULL )
> +        {
> +            msg_Err(p_dec, "Could not convert timestamps %"PRId64
> +                    ", %"PRId64" for %s", *pi_ts0, *pi_ts1, psz_name );
> +            *pi_ts1 = VLC_TS_INVALID;
> +            pi_ts1 = NULL; /* to skip rounding check */
> +        }
> +        else
> +            msg_Err(p_dec, "Could not convert timestamp %"PRId64" for %s",
> *pi_ts0, psz_name ); +        *pi_ts0 = VLC_TS_INVALID;
> +    }
> +
>      /* Do not create ephemere data because of rounding errors */
>      if( !b_ephemere && pi_ts1 && *pi_ts0 == *pi_ts1 )
>          *pi_ts1 += 1;


-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list