Commit 23eae026 authored by Laurent Aimar's avatar Laurent Aimar

Fixed INPUT_GET_VIDEO_FPS thread safety.

parent f6803fd0
...@@ -409,16 +409,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -409,16 +409,12 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
} }
case INPUT_GET_VIDEO_FPS: case INPUT_GET_VIDEO_FPS:
{
int i;
pf = (double*)va_arg( args, double * ); pf = (double*)va_arg( args, double * );
vlc_mutex_lock( &p_input->p->p_item->lock ); vlc_mutex_lock( &p_input->p->p_item->lock );
*pf = p_input->p->input.f_fps; *pf = p_input->p->f_fps;
for( i = 0; i < p_input->p->i_slave && *pf <= 0.001; i++ )
*pf = p_input->p->slave[i]->f_fps;
vlc_mutex_unlock( &p_input->p->p_item->lock ); vlc_mutex_unlock( &p_input->p->p_item->lock );
return VLC_SUCCESS; return VLC_SUCCESS;
}
case INPUT_ADD_SLAVE: case INPUT_ADD_SLAVE:
psz = (char*)va_arg( args, char * ); psz = (char*)va_arg( args, char * );
......
...@@ -1006,9 +1006,8 @@ static void LoadSubtitles( input_thread_t *p_input ) ...@@ -1006,9 +1006,8 @@ static void LoadSubtitles( input_thread_t *p_input )
{ {
/* Load subtitles */ /* Load subtitles */
/* Get fps and set it if not already set */ /* Get fps and set it if not already set */
double f_fps; const double f_fps = p_input->p->f_fps;
if( !demux_Control( p_input->p->input.p_demux, DEMUX_GET_FPS, &f_fps ) && if( f_fps > 1.0 )
f_fps > 1.0 )
{ {
float f_requested_fps; float f_requested_fps;
...@@ -2587,10 +2586,10 @@ static int InputSourceInit( input_thread_t *p_input, ...@@ -2587,10 +2586,10 @@ static int InputSourceInit( input_thread_t *p_input,
vlc_mutex_unlock( &p_input->p->p_item->lock ); vlc_mutex_unlock( &p_input->p->p_item->lock );
} }
} }
if( !demux_Control( in->p_demux, DEMUX_GET_FPS, &f_fps ) ) if( !demux_Control( in->p_demux, DEMUX_GET_FPS, &f_fps ) && f_fps > 0.0 )
{ {
vlc_mutex_lock( &p_input->p->p_item->lock ); vlc_mutex_lock( &p_input->p->p_item->lock );
in->f_fps = f_fps; p_input->p->f_fps = f_fps;
vlc_mutex_unlock( &p_input->p->p_item->lock ); vlc_mutex_unlock( &p_input->p->p_item->lock );
} }
......
...@@ -69,7 +69,6 @@ typedef struct ...@@ -69,7 +69,6 @@ typedef struct
bool b_rescale_ts; bool b_rescale_ts;
bool b_eof; /* eof of demuxer */ bool b_eof; /* eof of demuxer */
double f_fps;
} input_source_t; } input_source_t;
...@@ -82,10 +81,13 @@ struct input_thread_private_t ...@@ -82,10 +81,13 @@ struct input_thread_private_t
/* Global properties */ /* Global properties */
bool b_can_pause; bool b_can_pause;
bool b_can_rate_control; bool b_can_rate_control;
double f_fps;
/* Current state */
int i_rate; int i_rate;
bool b_recording; bool b_recording;
/* */
/* Playtime configuration */
int64_t i_start; /* :start-time,0 by default */ int64_t i_start; /* :start-time,0 by default */
int64_t i_stop; /* :stop-time, 0 if none */ int64_t i_stop; /* :stop-time, 0 if none */
int64_t i_run; /* :run-time, 0 if none */ int64_t i_run; /* :run-time, 0 if none */
......
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