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
......@@ -314,22 +314,10 @@ void input_ClockSetPCR( input_thread_t *p_input,
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)
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++;
}
}
}
}
......
......@@ -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