Commit 9192e5ff authored by Gildas Bazin's avatar Gildas Bazin

* src/input/clock.c: changes to the clock resync algo to remove some sensivity...

* src/input/clock.c: changes to the clock resync algo to remove some sensivity to the high frequencies jitterring when we start a stream.
* src/input/input.c: cr-average is now increased based on the input caching value.
parent ef70785d
......@@ -311,24 +311,12 @@ void input_ClockSetPCR( input_thread_t *p_input,
else
{
/* Smooth clock reference variations. */
mtime_t i_extrapoled_clock = ClockCurrent( p_input, cl );
mtime_t i_extrapoled_clock = ClockCurrent( p_input, cl );
/* Bresenham algorithm to smooth variations. */
if( cl->c_average_count == cl->i_cr_average )
{
cl->delta_cr = ( cl->delta_cr
* (cl->i_cr_average - 1)
+ ( i_extrapoled_clock - i_clock ) )
/ cl->i_cr_average;
}
else
{
cl->delta_cr = ( cl->delta_cr
* cl->c_average_count
+ ( i_extrapoled_clock - i_clock ) )
/ (cl->c_average_count + 1);
cl->c_average_count++;
}
cl->delta_cr = ( cl->delta_cr * (cl->i_cr_average - 1)
+ ( i_extrapoled_clock - i_clock ) )
/ cl->i_cr_average;
}
}
}
......
......@@ -566,6 +566,11 @@ static int Init( input_thread_t * p_input )
var_Get( p_input, "audio-desync", &val );
if( val.i_int < 0 ) p_input->i_pts_delay -= (val.i_int * 1000);
/* Update cr_average depending on the caching */
p_input->input.i_cr_average *= (10 * p_input->i_pts_delay / 200000);
p_input->input.i_cr_average /= 10;
if( p_input->input.i_cr_average <= 0 ) p_input->input.i_cr_average = 1;
/* Load master infos */
/* Init length */
if( !demux2_Control( p_input->input.p_demux, DEMUX_GET_LENGTH,
......
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