src/video_output/video_output.c:

 * if the given vout thread is a filter, then don't sleep untill the display
date. This reduces the chance of pictures being late when reaching the vout
if one or more filters are in use
 * don't include current render time in the render_time sliding mean if it
is way too large ( as inspired by Simon Gittins ).
 * weight the current sliding mean tree times more than the current render
time when calculating the new render time. This should make the code more
robust to jitter in render time
parent eba4590d
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* thread, and destroy a previously oppened video output thread. * thread, and destroy a previously oppened video output thread.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: video_output.c,v 1.234 2003/09/13 17:42:16 fenrir Exp $ * $Id: video_output.c,v 1.235 2003/09/14 13:54:43 sigmunau Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -816,7 +816,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -816,7 +816,7 @@ static void RunThread( vout_thread_t *p_vout)
} }
if( display_date > if( display_date >
current_date + p_vout->i_pts_delay + VOUT_BOGUS_DELAY ) current_date + p_vout->i_pts_delay + VOUT_BOGUS_DELAY )
{ {
/* Picture is waaay too early: it will be destroyed */ /* Picture is waaay too early: it will be destroyed */
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -896,16 +896,24 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -896,16 +896,24 @@ static void RunThread( vout_thread_t *p_vout)
*/ */
if( display_date != 0 && p_directbuffer != NULL ) if( display_date != 0 && p_directbuffer != NULL )
{ {
/* Store render time using a sliding mean */ mtime_t current_render_time = mdate() - current_date;
p_vout->render_time += mdate() - current_date; /* if render time is very large we don't include it in the mean */
p_vout->render_time >>= 1; if( current_render_time < p_vout->render_time +
VOUT_DISPLAY_DELAY )
{
/* Store render time using a sliding mean weighting to
* current value in a 3 to 1 ratio*/
p_vout->render_time *= 3;
p_vout->render_time += current_render_time;
p_vout->render_time >>= 2;
}
} }
/* Give back change lock */ /* Give back change lock */
vlc_mutex_unlock( &p_vout->change_lock ); vlc_mutex_unlock( &p_vout->change_lock );
/* Sleep a while or until a given date */ /* Sleep a while or until a given date */
if( display_date != 0 ) if( display_date != 0 && p_vout->psz_filter_chain == NULL )
{ {
mwait( display_date - VOUT_MWAIT_TOLERANCE ); mwait( display_date - VOUT_MWAIT_TOLERANCE );
} }
......
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