Commit eb1815f0 authored by Stéphane Borel's avatar Stéphane Borel
Browse files

-kludge to have less discontinuity after a zero scr in DVD.

Maybe we should try to predict the date instead of taking the last one but
it seems quite hard.
parent 3129e03d
......@@ -4,7 +4,7 @@
* 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>
*
......@@ -122,6 +122,7 @@ typedef struct pgrm_descriptor_s
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;
......
......@@ -2,7 +2,7 @@
* 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>
*
......@@ -124,7 +124,12 @@ static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
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 ;
}
/*****************************************************************************
......@@ -134,6 +139,7 @@ static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
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;
......@@ -161,6 +167,7 @@ int input_ClockManageControl( input_thread_t * p_input,
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 )
......@@ -233,6 +240,7 @@ void input_ClockManageRef( input_thread_t * p_input,
else
{
p_pgrm->last_cr = 0;
p_pgrm->last_syscr = 0;
p_pgrm->delta_cr = 0;
p_pgrm->c_average_count = 0;
}
......@@ -257,10 +265,15 @@ void input_ClockManageRef( input_thread_t * p_input,
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 );
......
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