Commit 5fe40a75 authored by Marian Durkovic's avatar Marian Durkovic

update cl->delta_cr only once per 200 msec to ensure better refclock

stability and mitigate temporary OS/network jitter problems
parent 89b3eb7e
......@@ -133,6 +133,7 @@ void input_ClockInit( input_clock_t *cl, vlc_bool_t b_master, int i_cr_average )
cl->last_cr = 0;
cl->last_pts = 0;
cl->last_sysdate = 0;
cl->cr_ref = 0;
cl->sysdate_ref = 0;
cl->delta_cr = 0;
......@@ -264,6 +265,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
else
{
cl->last_cr = 0;
cl->last_sysdate = 0;
cl->delta_cr = 0;
cl->i_delta_cr_residue = 0;
}
......@@ -308,7 +310,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
input_ClockManageControl( p_input, cl, i_clock );
#endif
}
else
else if ( mdate() - cl->last_sysdate > 200000 )
{
/* Smooth clock reference variations. */
mtime_t i_extrapoled_clock = ClockCurrent( p_input, cl );
......@@ -324,6 +326,7 @@ void input_ClockSetPCR( input_thread_t *p_input,
+ cl->i_delta_cr_residue )
% cl->i_cr_average;
cl->delta_cr = delta_cr;
cl->last_sysdate = mdate();
}
}
}
......
......@@ -133,6 +133,7 @@ typedef struct
/* Synchronization information */
mtime_t delta_cr;
mtime_t cr_ref, sysdate_ref;
mtime_t last_sysdate;
mtime_t last_cr; /* reference to detect unexpected stream
* discontinuities */
mtime_t last_pts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment