[vlc-commits] input: return/debug clock update delay
Francois Cartegnie
git at videolan.org
Tue Oct 15 17:08:58 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 11 18:15:54 2019 +0200| [6324cfa6f120265fdf5cf9c6d560ad8e3a94fe04] | committer: Francois Cartegnie
input: return/debug clock update delay
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6324cfa6f120265fdf5cf9c6d560ad8e3a94fe04
---
src/clock/input_clock.c | 6 +++---
src/clock/input_clock.h | 4 ++--
src/input/es_out.c | 14 ++++++++------
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/clock/input_clock.c b/src/clock/input_clock.c
index f9cbf4f37f..c7724625c4 100644
--- a/src/clock/input_clock.c
+++ b/src/clock/input_clock.c
@@ -199,8 +199,7 @@ void input_clock_Delete( input_clock_t *cl )
* i_ck_stream: date in stream clock
* i_ck_system: date in system clock
*****************************************************************************/
-void input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
- bool *pb_late,
+vlc_tick_t input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
bool b_can_pace_control, bool b_buffering_allowed,
vlc_tick_t i_ck_stream, vlc_tick_t i_ck_system )
{
@@ -279,7 +278,6 @@ void input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
* the goal of the clock here */
const vlc_tick_t i_system_expected = ClockStreamToSystem( cl, i_ck_stream + AvgGet( &cl->drift ) );
const vlc_tick_t i_late = ( i_ck_system - cl->i_pts_delay ) - i_system_expected;
- *pb_late = i_late > 0;
if( i_late > 0 )
{
cl->late.pi_value[cl->late.i_index] = i_late;
@@ -287,6 +285,8 @@ void input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
}
vlc_mutex_unlock( &cl->lock );
+
+ return i_late > 0 ? i_late : 0;
}
/*****************************************************************************
diff --git a/src/clock/input_clock.h b/src/clock/input_clock.h
index 1ec2a45895..1c8277a502 100644
--- a/src/clock/input_clock.h
+++ b/src/clock/input_clock.h
@@ -52,9 +52,9 @@ void input_clock_Delete( input_clock_t * );
*
* \param b_buffering_allowed tells if we are allowed to bufferize more data in
* advanced (if possible).
+ * \return clock update delay
*/
-void input_clock_Update( input_clock_t *, vlc_object_t *p_log,
- bool *pb_late,
+vlc_tick_t input_clock_Update( input_clock_t *, vlc_object_t *p_log,
bool b_can_pace_control, bool b_buffering_allowed,
vlc_tick_t i_clock, vlc_tick_t i_system );
/**
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 9fe622785e..b33d8e4c76 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3031,11 +3031,10 @@ 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_late;
bool b_extra_buffering_allowed = !input_priv(p_sys->p_input)->b_low_delay &&
EsOutIsExtraBufferingAllowed( out );
- input_clock_Update( p_pgrm->p_input_clock, VLC_OBJECT(p_sys->p_input),
- &b_late,
+ 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,
b_extra_buffering_allowed,
i_pcr, vlc_tick_now() );
@@ -3050,7 +3049,7 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
}
else if( p_pgrm == p_sys->p_pgrm )
{
- if( b_late && ( !input_priv(p_sys->p_input)->p_sout ||
+ if( i_late > 0 && ( !input_priv(p_sys->p_input)->p_sout ||
!input_priv(p_sys->p_input)->b_out_pace_control ) )
{
vlc_tick_t i_pts_delay = input_clock_GetJitter( p_pgrm->p_input_clock );
@@ -3063,8 +3062,10 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
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)",
+ "ES_OUT_SET_(GROUP_)PCR is called %d ms late (jitter of %d ms ignored)",
+ (int)MS_FROM_VLC_TICK(i_late),
(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_tracks_pts_delay;
@@ -3078,7 +3079,8 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
else
{
msg_Err( p_sys->p_input,
- "ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to %d ms)",
+ "ES_OUT_SET_(GROUP_)PCR is called %d ms late (pts_delay increased to %d ms)",
+ (int)MS_FROM_VLC_TICK(i_late),
(int)MS_FROM_VLC_TICK(i_pts_delay) );
/* Force a rebufferization when we are too late */
More information about the vlc-commits
mailing list