]> git.sesse.net Git - vlc/commitdiff
Fixed INPUT_GET_VIDEO_FPS thread safety.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 3 Dec 2008 22:10:04 +0000 (23:10 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 4 Dec 2008 19:34:07 +0000 (20:34 +0100)
src/input/control.c
src/input/input.c
src/input/input_internal.h

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