Commit 2f64eb29 authored by Christophe Massiot's avatar Christophe Massiot

* Fixed a bug in the frame rate handling ;

* Fixed a bug in the DTS/PTS ordering.
Our pts are _at last_ accurate.
parent 3a3f1725
......@@ -2,7 +2,7 @@
* vpar_synchro.h : video parser blocks management
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_synchro.h,v 1.5 2001/01/15 18:02:49 massiot Exp $
* $Id: vpar_synchro.h,v 1.6 2001/01/15 19:54:34 massiot Exp $
*
* Author: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -64,7 +64,9 @@ typedef struct video_synchro_s
unsigned int i_eta_p, i_eta_b;
boolean_t b_dropped_last; /* for special synchros below */
mtime_t backward_pts, current_pts;
mtime_t next_period; /* period to add to the next picture */
mtime_t current_period; /* period to add to the next picture */
mtime_t backward_period; /* period to add after the next
* reference picture */
#ifdef STATS
unsigned int i_trashed_pic, i_not_chosen_pic, i_pic;
......
......@@ -2,7 +2,7 @@
* vpar_headers.c : headers parsing
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_headers.c,v 1.69 2001/01/15 18:02:49 massiot Exp $
* $Id: vpar_headers.c,v 1.70 2001/01/15 19:54:34 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -565,7 +565,8 @@ static void PictureHeader( vpar_thread_t * p_vpar )
p_vpar->picture.b_q_scale_type = 0;
p_vpar->picture.b_intra_vlc_format = 0;
p_vpar->picture.b_alternate_scan = 0; /* zigzag */
p_vpar->picture.b_repeat_first_field = 1;
p_vpar->picture.b_repeat_first_field = 1; /* FIXME! this contradicts
* ISO/IEC */
p_vpar->picture.b_progressive = 1;
}
......
......@@ -2,7 +2,7 @@
* vpar_synchro.c : frame dropping routines
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vpar_synchro.c,v 1.73 2001/01/15 18:02:49 massiot Exp $
* $Id: vpar_synchro.c,v 1.74 2001/01/15 19:54:34 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -150,7 +150,8 @@ void vpar_SynchroInit( vpar_thread_t * p_vpar )
memset( p_vpar->synchro.pi_meaningful, 0, 4 * sizeof(unsigned int) );
p_vpar->synchro.b_dropped_last = 0;
p_vpar->synchro.current_pts = mdate() + DEFAULT_PTS_DELAY;
p_vpar->synchro.backward_pts = p_vpar->synchro.next_period = 0;
p_vpar->synchro.backward_pts = p_vpar->synchro.current_period =
p_vpar->synchro.backward_period = 0;
#ifdef STATS
p_vpar->synchro.i_trashed_pic = p_vpar->synchro.i_not_chosen_pic =
p_vpar->synchro.i_pic = 0;
......@@ -228,7 +229,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
#endif
now = mdate();
period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001;
period = 1000000 * 1001 / p_vpar->sequence.i_frame_rate;
vlc_mutex_lock( &p_vpar->p_vout->change_lock );
tau_yuv = p_vpar->p_vout->render_time;
......@@ -420,7 +421,7 @@ mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
int i_repeat_field )
{
mtime_t period = 1000000 / (p_vpar->sequence.i_frame_rate) * 1001;
mtime_t period = 1000000 * 1001 / p_vpar->sequence.i_frame_rate;
switch( i_coding_type )
{
......@@ -468,16 +469,16 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
break;
}
p_vpar->synchro.current_pts += p_vpar->synchro.next_period;
/* A video frame can be displayed 1, 2 or 3 times, according to
* repeat_first_field, top_field_first, progressive_sequence and
* progressive_frame. */
p_vpar->synchro.next_period = i_repeat_field * (period >> 1);
p_vpar->synchro.current_pts += p_vpar->synchro.current_period;
#define PTS_THRESHOLD (period >> 2)
if( i_coding_type == B_CODING_TYPE )
{
/* A video frame can be displayed 1, 2 or 3 times, according to
* repeat_first_field, top_field_first, progressive_sequence and
* progressive_frame. */
p_vpar->synchro.current_period = i_repeat_field * (period >> 1);
if( p_vpar->sequence.next_pts )
{
if( p_vpar->sequence.next_pts - p_vpar->synchro.current_pts
......@@ -496,6 +497,9 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
}
else
{
p_vpar->synchro.current_period = p_vpar->synchro.backward_period;
p_vpar->synchro.backward_period = i_repeat_field * (period >> 1);
if( p_vpar->synchro.backward_pts )
{
if( p_vpar->sequence.next_dts &&
......@@ -506,10 +510,9 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
{
intf_WarnMsg( 2,
"vpar synchro warning: backward_pts != dts (%lld)",
p_vpar->synchro.backward_pts
- p_vpar->sequence.next_dts );
p_vpar->sequence.next_dts
- p_vpar->synchro.backward_pts );
}
if( p_vpar->synchro.backward_pts - p_vpar->synchro.current_pts
> PTS_THRESHOLD
|| p_vpar->synchro.current_pts - p_vpar->synchro.backward_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