[vlc-devel] [PATCH 2/2] input: es_out: workaround median delay initial value with low_delay

Francois Cartegnie fcvlcdev at free.fr
Thu Oct 17 13:55:11 CEST 2019


---
 src/input/es_out.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index e8e6563268..306c161786 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3032,8 +3032,8 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
         }
 
         /* TODO do not use vlc_tick_now() but proper stream acquisition date */
-        bool b_extra_buffering_allowed = !input_priv(p_sys->p_input)->b_low_delay &&
-                                         EsOutIsExtraBufferingAllowed( out );
+        const bool b_low_delay = input_priv(p_sys->p_input)->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,
@@ -3077,7 +3077,12 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
                 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 || i_clock_total_delay > INPUT_PTS_DELAY_MAX )
+                if( i_new_jitter > 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) )
                 {
                     msg_Err( p_sys->p_input,
                              "ES_OUT_SET_(GROUP_)PCR  is called %d ms late (jitter of %d ms ignored)",
-- 
2.21.0



More information about the vlc-devel mailing list