]> git.sesse.net Git - vlc/commitdiff
Remove uninitialized and unsynchronized global stats
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 28 Feb 2009 17:16:29 +0000 (19:16 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 28 Feb 2009 17:16:29 +0000 (19:16 +0200)
This could crash the input thread(s).

include/vlc_main.h
src/input/input.c
src/libvlc.c
src/libvlc.h

index 119b177bc1d960cbc48478079c615541b95ff8e7..0d2ce47e01c59fdbfb91dd6b3d10507d6622c98d 100644 (file)
@@ -37,9 +37,6 @@ struct libvlc_int_t
 {
     VLC_COMMON_MEMBERS
 
-    /* FIXME: this is only used by the logger module! */
-    global_stats_t       *p_stats;           ///< Global statistics
-
     /* Structure storing the action name / key associations */
     struct hotkey
     {
index cb9e6de39fd49744a457672b4201c9a75a28efcd..7d05ae2f1d105ac19673d0d35292028d33253635 100644 (file)
@@ -149,17 +149,6 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     if( !p_input->p )
         return NULL;
 
-    /* One "randomly" selected input thread is responsible for computing
-     * the global stats. Check if there is already someone doing this */
-    if( p_input->p_libvlc->p_stats && !b_quick )
-    {
-        libvlc_priv_t *p_private = libvlc_priv( p_input->p_libvlc );
-        vlc_mutex_lock( &p_input->p_libvlc->p_stats->lock );
-        if( p_private->p_stats_computer == NULL )
-            p_private->p_stats_computer = p_input;
-        vlc_mutex_unlock( &p_input->p_libvlc->p_stats->lock );
-    }
-
     p_input->b_preparsing = b_quick;
     p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
 
@@ -700,12 +689,6 @@ static void MainLoopInterface( input_thread_t *p_input )
 static void MainLoopStatistic( input_thread_t *p_input )
 {
     stats_ComputeInputStats( p_input, p_input->p->p_item->p_stats );
-    /* Are we the thread responsible for computing global stats ? */
-    if( libvlc_priv( p_input->p_libvlc )->p_stats_computer == p_input )
-    {
-        stats_ComputeGlobalStats( p_input->p_libvlc,
-                                  p_input->p_libvlc->p_stats );
-    }
     input_SendEventStatistics( p_input );
 }
 
@@ -1324,13 +1307,6 @@ static void End( input_thread_t * p_input )
 
             /* make sure we are up to date */
             stats_ComputeInputStats( p_input, p_input->p->p_item->p_stats );
-            if( p_private->p_stats_computer == p_input )
-            {
-                stats_ComputeGlobalStats( p_input->p_libvlc,
-                                          p_input->p_libvlc->p_stats );
-                /* FIXME how can it be thread safe ? */
-                p_private->p_stats_computer = NULL;
-            }
             CL_CO( read_bytes );
             CL_CO( read_packets );
             CL_CO( demux_read );
index fb7aa5257967965797b680513ca7e971eec2b113..1d1d71d7bbcfe1fc3c90e9b8d3bcf933bc08f616 100644 (file)
@@ -791,16 +791,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     priv->i_timers = 0;
     priv->pp_timers = NULL;
 
-    /* Init stats */
-    p_libvlc->p_stats = (global_stats_t *)malloc( sizeof( global_stats_t ) );
-    if( !p_libvlc->p_stats )
-    {
-        vlc_object_release( p_libvlc );
-        return VLC_ENOMEM; /* FIXME: leaks */
-    }
-    vlc_mutex_init( &p_libvlc->p_stats->lock );
-    priv->p_stats_computer = NULL;
-
     priv->i_last_input_id = 0; /* Not very safe, should be removed */
 
     /*
@@ -1080,8 +1070,6 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     stats_TimersCleanAll( p_libvlc );
 
     msg_Dbg( p_libvlc, "removing stats" );
-    vlc_mutex_destroy( &p_libvlc->p_stats->lock );
-    FREENULL( p_libvlc->p_stats );
 
 #ifndef WIN32
     char* psz_pidfile = NULL;
index 20eea3a837eb6660fcaf8a122838aa9c888637f5..bf5094dfc66c703f54d362639330ed564d630ad0 100644 (file)
@@ -217,9 +217,6 @@ typedef struct libvlc_priv_t
     int                i_timers;    ///< Number of timers
     bool               b_stats;     ///< Whether to collect stats
 
-    void              *p_stats_computer;  ///< Input thread computing stats
-                                          /// (needs cleanup)
-
     /* Singleton objects */
     module_t          *p_memcpy_module;  ///< Fast memcpy plugin used
     playlist_t        *p_playlist; //< the playlist singleton