[vlc-devel] [PATCH] input_clock: remove unused input_clock_ConvertTS
Thomas Guillem
thomas at gllm.fr
Fri Aug 14 10:08:38 CEST 2020
LGTM
On Thu, Aug 13, 2020, at 14:09, Steve Lhomme wrote:
> Also remove internal i_ts_max which is always VLC_TICK_INVALID, and yet was
> used as a valid value.
> ---
> src/clock/input_clock.c | 68 +----------------------------------------
> src/clock/input_clock.h | 20 +-----------
> 2 files changed, 2 insertions(+), 86 deletions(-)
>
> diff --git a/src/clock/input_clock.c b/src/clock/input_clock.c
> index ac891d8cb99..a143f02fc6f 100644
> --- a/src/clock/input_clock.c
> +++ b/src/clock/input_clock.c
> @@ -111,9 +111,6 @@ struct input_clock_t
> * It is used to detect unexpected stream discontinuities */
> clock_point_t last;
>
> - /* Maximal timestamp returned by input_clock_ConvertTS (in system unit) */
> - vlc_tick_t i_ts_max;
> -
> /* Amount of extra buffering expressed in stream clock */
> vlc_tick_t i_buffering_duration;
>
> @@ -164,8 +161,6 @@ input_clock_t *input_clock_New( float rate )
>
> cl->last = clock_point_Create( VLC_TICK_INVALID, VLC_TICK_INVALID );
>
> - cl->i_ts_max = VLC_TICK_INVALID;
> -
> cl->i_buffering_duration = 0;
>
> cl->i_next_drift_update = VLC_TICK_INVALID;
> @@ -221,7 +216,6 @@ vlc_tick_t input_clock_Update( input_clock_t *cl,
> vlc_object_t *p_log,
> * warning from the stream control facilities (dd-edited
> * stream ?). */
> msg_Warn( p_log, "clock gap, unexpected stream discontinuity"
> );
> - cl->i_ts_max = VLC_TICK_INVALID;
>
> /* */
> msg_Warn( p_log, "feeding synchro with a new reference point
> trying to recover from clock gap" );
> @@ -236,7 +230,7 @@ vlc_tick_t input_clock_Update( input_clock_t *cl,
> vlc_object_t *p_log,
>
> /* Feed synchro with a new reference point. */
> cl->b_has_reference = true;
> - cl->ref = clock_point_Create( __MAX( cl->i_ts_max +
> CR_MEAN_PTS_GAP, i_ck_system ),
> + cl->ref = clock_point_Create( __MAX( CR_MEAN_PTS_GAP,
> i_ck_system ),
> i_ck_stream );
> cl->b_has_external_clock = false;
> }
> @@ -298,7 +292,6 @@ void input_clock_Reset( input_clock_t *cl )
> cl->b_has_reference = false;
> cl->ref = clock_point_Create( VLC_TICK_INVALID, VLC_TICK_INVALID );
> cl->b_has_external_clock = false;
> - cl->i_ts_max = VLC_TICK_INVALID;
>
> vlc_mutex_unlock( &cl->lock );
> }
> @@ -363,65 +356,6 @@ vlc_tick_t input_clock_GetWakeup( input_clock_t *cl )
> return i_wakeup;
> }
>
> -/*****************************************************************************
> - * input_clock_ConvertTS
> -
> *****************************************************************************/
> -int input_clock_ConvertTS( vlc_object_t *p_object, input_clock_t *cl,
> - float *p_rate, vlc_tick_t *pi_ts0,
> vlc_tick_t *pi_ts1,
> - vlc_tick_t i_ts_bound )
> -{
> - assert( pi_ts0 );
> - vlc_mutex_lock( &cl->lock );
> -
> - if( p_rate )
> - *p_rate = cl->rate;
> -
> - if( !cl->b_has_reference )
> - {
> - vlc_mutex_unlock( &cl->lock );
> - msg_Err(p_object, "Timestamp conversion failed for %"PRId64": "
> - "no reference clock", *pi_ts0);
> - *pi_ts0 = VLC_TICK_INVALID;
> - if( pi_ts1 )
> - *pi_ts1 = VLC_TICK_INVALID;
> - return VLC_EGENERIC;
> - }
> -
> - /* */
> - const vlc_tick_t i_ts_buffering = cl->i_buffering_duration /
> cl->rate;
> - const vlc_tick_t i_ts_delay = cl->i_pts_delay + ClockGetTsOffset(
> cl );
> -
> - /* */
> - if( *pi_ts0 != VLC_TICK_INVALID )
> - {
> - *pi_ts0 = ClockStreamToSystem( cl, *pi_ts0 + AvgGet(
> &cl->drift ) );
> - if( *pi_ts0 > cl->i_ts_max )
> - cl->i_ts_max = *pi_ts0;
> - *pi_ts0 += i_ts_delay;
> - }
> -
> - /* XXX we do not update i_ts_max on purpose */
> - if( pi_ts1 && *pi_ts1 != VLC_TICK_INVALID )
> - {
> - *pi_ts1 = ClockStreamToSystem( cl, *pi_ts1 + AvgGet(
> &cl->drift ) ) +
> - i_ts_delay;
> - }
> -
> - vlc_mutex_unlock( &cl->lock );
> -
> - /* Check ts validity */
> - if (i_ts_bound != INT64_MAX && *pi_ts0 != VLC_TICK_INVALID) {
> - if (*pi_ts0 >= vlc_tick_now() + i_ts_delay + i_ts_buffering +
> i_ts_bound) {
> - msg_Err(p_object,
> - "Timestamp conversion failed (delay %"PRId64",
> buffering "
> - "%"PRId64", bound %"PRId64")",
> - i_ts_delay, i_ts_buffering, i_ts_bound);
> - return VLC_EGENERIC;
> - }
> - }
> -
> - return VLC_SUCCESS;
> -}
>
> /*****************************************************************************
> * input_clock_GetRate: Return current rate
>
> *****************************************************************************/
> diff --git a/src/clock/input_clock.h b/src/clock/input_clock.h
> index 1c8277a502c..a1bb2a78cfa 100644
> --- a/src/clock/input_clock.h
> +++ b/src/clock/input_clock.h
> @@ -30,8 +30,7 @@
> /** @struct input_clock_t
> * This structure is used to manage clock drift and reception jitters
> *
> - * XXX input_clock_ConvertTS can be called from any threads. All
> others functions
> - * MUST be called from one and only one thread.
> + * All functions MUST be called from one and only one thread.
> */
> typedef struct input_clock_t input_clock_t;
>
> @@ -93,23 +92,6 @@ void input_clock_GetSystemOrigin( input_clock_t
> *, vlc_tick_t *pi_system, vlc
> */
> void input_clock_ChangeSystemOrigin( input_clock_t *, bool
> b_absolute, vlc_tick_t i_system );
>
> -/**
> - * This function converts a pair of timestamp from stream clock to
> system clock.
> - *
> - * If p_rate is provided it will be filled with the rate value used for
> - * the conversion.
> - * p_ts0 is a pointer to a timestamp to be converted (in place) and
> must be non NULL.
> - * p_ts1 is a pointer to a timestamp to be converted (in place) and
> can be NULL.
> - *
> - * It will return VLC_EGENERIC if i_ts_bound is not INT64_MAX and if
> the value *p_ts0
> - * after conversion is not before the deadline vlc_tick_now() +
> i_pts_delay + i_ts_bound.
> - * It will also return VLC_EGENERIC if the conversion cannot be done
> successfully. In
> - * this case, *p_ts0 and *p_ts1 will hold an invalid timestamp.
> - * Otherwise it will return VLC_SUCCESS.
> - */
> -int input_clock_ConvertTS( vlc_object_t *, input_clock_t *, float
> *p_rate,
> - vlc_tick_t *pi_ts0, vlc_tick_t *pi_ts1,
> vlc_tick_t i_ts_bound );
> -
> /**
> * This function returns the current rate.
> */
> --
> 2.26.2
>
> _______________________________________________
> 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