Commit f0172537 authored by Laurent Aimar's avatar Laurent Aimar

Implemented an fps(50) limiter in projectM.

parent 4308fd1d
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifndef __STDC_CONSTANT_MACROS
# define __STDC_CONSTANT_MACROS
#endif
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
...@@ -318,6 +321,7 @@ static void *Thread( void *p_data ) ...@@ -318,6 +321,7 @@ static void *Thread( void *p_data )
int i_last_height = 0; int i_last_height = 0;
for( ;; ) for( ;; )
{ {
const mtime_t i_deadline = mdate() + CLOCK_FREQ / 50; /* 50 fps max */
/* Manage the events */ /* Manage the events */
vout_ManageDisplay( p_sys->p_vd, true ); vout_ManageDisplay( p_sys->p_vd, true );
if( p_sys->p_vd->cfg->display.width != i_last_width || if( p_sys->p_vd->cfg->display.width != i_last_width ||
...@@ -344,16 +348,16 @@ static void *Thread( void *p_data ) ...@@ -344,16 +348,16 @@ static void *Thread( void *p_data )
p_sys->p_projectm->renderFrame(); p_sys->p_projectm->renderFrame();
/* */
vlc_restorecancel( cancel );
mwait( i_deadline );
cancel = vlc_savecancel();
if( !vout_opengl_Lock(gl) ) if( !vout_opengl_Lock(gl) )
{ {
vout_opengl_Swap( gl ); vout_opengl_Swap( gl );
vout_opengl_Unlock( gl ); vout_opengl_Unlock( gl );
} }
/* TODO: use a fps limiter */
vlc_restorecancel( cancel );
msleep( 10000 );
cancel = vlc_savecancel();
} }
vlc_cleanup_pop(); vlc_cleanup_pop();
abort(); abort();
......
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