[vlc-devel] commit: Privatize the stats computer ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun May 4 20:38:57 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sun May 4 21:36:25 2008 +0300| [6b42b421710760b88561364ecc585b93aee7790a]
Privatize the stats computer
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6b42b421710760b88561364ecc585b93aee7790a
---
include/vlc_main.h | 1 -
src/input/input.c | 17 +++++++++--------
src/libvlc-common.c | 2 +-
src/libvlc.h | 3 +++
4 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/vlc_main.h b/include/vlc_main.h
index 9039cb8..76356bc 100644
--- a/include/vlc_main.h
+++ b/include/vlc_main.h
@@ -45,7 +45,6 @@ struct libvlc_int_t
playlist_t *p_playlist; ///< playlist object
- void *p_stats_computer; ///< Input thread computing stats (needs cleanup)
global_stats_t *p_stats; ///< Global statistics
/* There is no real reason to keep a list of items, but not to break
diff --git a/src/input/input.c b/src/input/input.c
index 0960836..fd9c4cf 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -158,11 +158,10 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
* the global stats. Check if there is already someone doing this */
if( p_input->p_libvlc->p_stats && !b_quick )
{
+ libvlc_priv_t *priv = libvlc_priv (p_input->p_libvlc);
vlc_mutex_lock( &p_input->p_libvlc->p_stats->lock );
- if( p_input->p_libvlc->p_stats_computer == NULL )
- {
- p_input->p_libvlc->p_stats_computer = p_input;
- }
+ if( priv->p_stats_computer == NULL )
+ priv->p_stats_computer = p_input;
vlc_mutex_unlock( &p_input->p_libvlc->p_stats->lock );
}
@@ -779,10 +778,10 @@ static void MainLoop( input_thread_t *p_input )
{
stats_ComputeInputStats( p_input, p_input->p->input.p_item->p_stats );
/* Are we the thread responsible for computing global stats ? */
- if( p_input->p_libvlc->p_stats_computer == p_input )
+ if( libvlc_priv (p_input->p_libvlc)->p_stats_computer == p_input )
{
stats_ComputeGlobalStats( p_input->p_libvlc,
- p_input->p_libvlc->p_stats );
+ p_input->p_libvlc->p_stats );
}
}
}
@@ -1345,13 +1344,15 @@ static void End( input_thread_t * p_input )
#define CL_CO( c ) stats_CounterClean( p_input->p->counters.p_##c ); p_input->p->counters.p_##c = NULL;
if( libvlc_stats (p_input) )
{
+ libvlc_priv_t *priv = libvlc_priv (p_input->p_libvlc);
+
/* make sure we are up to date */
stats_ComputeInputStats( p_input, p_input->p->input.p_item->p_stats );
- if( p_input->p_libvlc->p_stats_computer == p_input )
+ if( priv->p_stats_computer == p_input )
{
stats_ComputeGlobalStats( p_input->p_libvlc,
p_input->p_libvlc->p_stats );
- p_input->p_libvlc->p_stats_computer = NULL;
+ priv->p_stats_computer = NULL;
}
CL_CO( read_bytes );
CL_CO( read_packets );
diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index 7be719c..145268e 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -722,7 +722,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
return VLC_ENOMEM;
}
vlc_mutex_init( &p_libvlc->p_stats->lock );
- p_libvlc->p_stats_computer = NULL;
+ priv->p_stats_computer = NULL;
/* Init the array that holds every input item */
ARRAY_INIT( p_libvlc->input_items );
diff --git a/src/libvlc.h b/src/libvlc.h
index 9088550..a359e52 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -223,6 +223,9 @@ 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)
+
module_t *p_memcpy_module; ///< Fast memcpy plugin used
vlm_t *p_vlm; ///< VLM if created from libvlc-common.c
vlc_object_t *p_interaction; ///< interface interaction object
More information about the vlc-devel
mailing list