Commit 59c9e899 authored by Jean-Paul Saman's avatar Jean-Paul Saman

v4l2: calculate duration only once

parent 62ba2f68
......@@ -560,6 +560,7 @@ struct demux_sys_t
float f_fps; /* <= 0.0 mean to grab at full rate */
mtime_t i_video_pts; /* only used when f_fps > 0 */
int i_fourcc;
mtime_t i_duration; /* frame duration calculation */
es_out_id_t *p_es;
......@@ -669,6 +670,8 @@ static int DemuxOpen( vlc_object_t *p_this )
ParseMRL( p_sys, p_demux->psz_path, (vlc_object_t *) p_demux );
p_sys->i_duration = (mtime_t)((double)1000000 / (double)p_sys->f_fps);
#ifdef HAVE_LIBV4L2
if( !config_GetInt( p_this, CFG_PREFIX "use-libv4l2" ) )
{
......@@ -1298,10 +1301,8 @@ static block_t* GrabVideo( demux_t *p_demux )
if( p_sys->f_fps >= 0.1 && p_sys->i_video_pts > 0 )
{
mtime_t i_dur = (mtime_t)((double)1000000 / (double)p_sys->f_fps);
/* Did we wait long enough ? (frame rate reduction) */
if( p_sys->i_video_pts + i_dur > mdate() ) return NULL;
if( p_sys->i_video_pts + p_sys->i_duration > mdate() ) return NULL;
}
/* Grab Video Frame */
......
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