* control the pace of reading.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.44 2001/10/02 16:46:59 massiot Exp $
+ * $Id: input_ext-intf.h,v 1.45 2001/11/08 14:45:44 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
mtime_t cr_ref, sysdate_ref;
mtime_t last_cr; /* reference to detect unexpected stream
* discontinuities */
+ mtime_t last_syscr;
count_t c_average_count;
/* counter used to compute dynamic average values */
int i_synchro_state;
* input_clock.c: Clock/System date convertions, stream management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_clock.c,v 1.22 2001/09/05 16:07:50 massiot Exp $
+ * $Id: input_clock.c,v 1.23 2001/11/08 14:45:44 stef Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
mtime_t i_clock, mtime_t i_sysdate )
{
p_pgrm->cr_ref = i_clock;
- p_pgrm->sysdate_ref = i_sysdate;
+ /* this is actually a kludge, but it gives better results when scr
+ * is zero in DVDs: we are 3-4 ms in advance instead of sometimes
+ * 100ms late */
+ p_pgrm->sysdate_ref = ( p_pgrm->last_syscr && !i_clock )
+ ? p_pgrm->last_syscr
+ : i_sysdate ;
}
/*****************************************************************************
void input_ClockInit( pgrm_descriptor_t * p_pgrm )
{
p_pgrm->last_cr = 0;
+ p_pgrm->last_syscr = 0;
p_pgrm->cr_ref = 0;
p_pgrm->sysdate_ref = 0;
p_pgrm->delta_cr = 0;
p_input->stream.control.i_status = PAUSE_S;
vlc_cond_wait( &p_input->stream.stream_wait,
&p_input->stream.stream_lock );
+ p_pgrm->last_syscr = 0;
ClockNewRef( p_input, p_pgrm, i_clock, mdate() );
if( p_input->stream.i_new_status == PAUSE_S )
else
{
p_pgrm->last_cr = 0;
+ p_pgrm->last_syscr = 0;
p_pgrm->delta_cr = 0;
p_pgrm->c_average_count = 0;
}
if( p_input->stream.b_pace_control
&& p_input->stream.pp_programs[0] == p_pgrm )
{
+ /* We remember the last system date to be able to restart
+ * the synchro we statistically better continuity, after
+ * a zero scr */
+ p_pgrm->last_syscr = ClockToSysdate( p_input, p_pgrm, i_clock );
+
/* Wait a while before delivering the packets to the decoder.
* In case of multiple programs, we arbitrarily follow the
* clock of the first program. */
- mwait( ClockToSysdate( p_input, p_pgrm, i_clock ) );
+ mwait( p_pgrm->last_syscr );
/* Now take into account interface changes. */
input_ClockManageControl( p_input, p_pgrm, i_clock );