[vlc-devel] [PATCH] input: read the "clock-jitter" variable only once
Steve Lhomme
robux4 at ycbcr.xyz
Thu Aug 13 14:10:38 CEST 2020
It's not going to change after the init.
---
src/input/es_out.c | 16 ++++++++--------
src/input/input.c | 1 +
src/input/input_internal.h | 1 +
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 7fad533e65d..e4b840ed750 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3169,12 +3169,14 @@ static int EsOutVaControlLocked( es_out_t *out, input_source_t *source,
return VLC_EGENERIC;
}
+ input_thread_private_t *priv = input_priv(p_sys->p_input);
+
/* TODO do not use vlc_tick_now() but proper stream acquisition date */
- const bool b_low_delay = input_priv(p_sys->p_input)->b_low_delay;
+ const bool b_low_delay = priv->b_low_delay;
bool b_extra_buffering_allowed = !b_low_delay && EsOutIsExtraBufferingAllowed( out );
vlc_tick_t i_late = input_clock_Update(
p_pgrm->p_input_clock, VLC_OBJECT(p_sys->p_input),
- input_priv(p_sys->p_input)->b_can_pace_control || p_sys->b_buffering,
+ priv->b_can_pace_control || p_sys->b_buffering,
b_extra_buffering_allowed,
i_pcr, vlc_tick_now() );
@@ -3190,8 +3192,8 @@ static int EsOutVaControlLocked( es_out_t *out, input_source_t *source,
{
/* Last pcr/clock update was late. We need to compensate by offsetting
from the clock the rendering dates */
- if( i_late > 0 && ( !input_priv(p_sys->p_input)->p_sout ||
- !input_priv(p_sys->p_input)->b_out_pace_control ) )
+ if( i_late > 0 && ( !priv->p_sout ||
+ !priv->b_out_pace_control ) )
{
/* input_clock_GetJitter returns compound delay:
* - initial pts delay (buffering/caching)
@@ -3212,15 +3214,13 @@ static int EsOutVaControlLocked( es_out_t *out, input_source_t *source,
* and flush buffers (because all previous pts will now be late) */
/* Avoid dangerously high value */
- const vlc_tick_t i_jitter_max =
- VLC_TICK_FROM_MS(var_InheritInteger( p_sys->p_input, "clock-jitter" ));
/* If the jitter increase is over our max or the total hits the maximum */
- if( i_new_jitter > i_jitter_max ||
+ if( i_new_jitter > priv->i_jitter_max ||
i_clock_total_delay > INPUT_PTS_DELAY_MAX ||
/* jitter is always 0 due to median calculation first output
and low delay can't allow non reversible jitter increase
in branch below */
- (b_low_delay && i_late > i_jitter_max) )
+ (b_low_delay && i_late > priv->i_jitter_max) )
{
msg_Err( p_sys->p_input,
"ES_OUT_SET_(GROUP_)PCR is called %d ms late (jitter of %d ms ignored)",
diff --git a/src/input/input.c b/src/input/input.c
index d6256fef47b..28de738f8ab 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -397,6 +397,7 @@ static input_thread_t *Create( vlc_object_t *p_parent,
input_ConfigVarInit( p_input );
priv->b_low_delay = var_InheritBool( p_input, "low-delay" );
+ priv->i_jitter_max = VLC_TICK_FROM_MS(var_InheritInteger( p_input, "clock-jitter" ));
/* Remove 'Now playing' info as it is probably outdated */
input_item_SetNowPlaying( p_item, NULL );
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index f99e6805eb7..0bc67098f3c 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -490,6 +490,7 @@ typedef struct input_thread_private_t
/* Delays */
bool b_low_delay;
+ vlc_tick_t i_jitter_max;
/* Output */
bool b_out_pace_control; /* XXX Move it ot es_sout ? */
--
2.26.2
More information about the vlc-devel
mailing list