Commit c72674da authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove redundant object parameter to stats functions

parent 32167b7e
...@@ -1328,11 +1328,11 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) ...@@ -1328,11 +1328,11 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock); vlc_mutex_lock( &p_input->p->counters.counters_lock);
stats_UpdateInteger( p_dec, p_input->p->counters.p_lost_abuffers, stats_UpdateInteger( p_input->p->counters.p_lost_abuffers,
i_lost, NULL ); i_lost, NULL );
stats_UpdateInteger( p_dec, p_input->p->counters.p_played_abuffers, stats_UpdateInteger( p_input->p->counters.p_played_abuffers,
i_played, NULL ); i_played, NULL );
stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_audio, stats_UpdateInteger( p_input->p->counters.p_decoded_audio,
i_decoded, NULL ); i_decoded, NULL );
vlc_mutex_unlock( &p_input->p->counters.counters_lock); vlc_mutex_unlock( &p_input->p->counters.counters_lock);
...@@ -1557,12 +1557,12 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block ) ...@@ -1557,12 +1557,12 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_video, stats_UpdateInteger( p_input->p->counters.p_decoded_video,
i_decoded, NULL ); i_decoded, NULL );
stats_UpdateInteger( p_dec, p_input->p->counters.p_lost_pictures, stats_UpdateInteger( p_input->p->counters.p_lost_pictures,
i_lost , NULL); i_lost , NULL);
stats_UpdateInteger( p_dec, p_input->p->counters.p_displayed_pictures, stats_UpdateInteger( p_input->p->counters.p_displayed_pictures,
i_displayed, NULL); i_displayed, NULL);
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
...@@ -1956,8 +1956,7 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush ...@@ -1956,8 +1956,7 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush
if( p_input != NULL ) if( p_input != NULL )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( p_dec, p_input->p->counters.p_decoded_sub, 1, stats_UpdateInteger( p_input->p->counters.p_decoded_sub, 1, NULL );
NULL );
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
} }
......
...@@ -1925,21 +1925,21 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block ) ...@@ -1925,21 +1925,21 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
if( libvlc_stats( p_input ) ) if( libvlc_stats( p_input ) )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( p_input, p_input->p->counters.p_demux_read, stats_UpdateInteger( p_input->p->counters.p_demux_read,
p_block->i_buffer, &i_total ); p_block->i_buffer, &i_total );
stats_UpdateFloat( p_input , p_input->p->counters.p_demux_bitrate, stats_UpdateFloat( p_input->p->counters.p_demux_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
/* Update number of corrupted data packats */ /* Update number of corrupted data packats */
if( p_block->i_flags & BLOCK_FLAG_CORRUPTED ) if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
{ {
stats_UpdateInteger( p_input, p_input->p->counters.p_demux_corrupted, stats_UpdateInteger( p_input->p->counters.p_demux_corrupted,
1, NULL ); 1, NULL );
} }
/* Update number of discontinuities */ /* Update number of discontinuities */
if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY ) if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
{ {
stats_UpdateInteger( p_input, p_input->p->counters.p_demux_discontinuity, stats_UpdateInteger( p_input->p->counters.p_demux_discontinuity,
1, NULL ); 1, NULL );
} }
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
......
...@@ -852,7 +852,7 @@ static void InitStatistics( input_thread_t * p_input ) ...@@ -852,7 +852,7 @@ static void InitStatistics( input_thread_t * p_input )
/* Prepare statistics */ /* Prepare statistics */
#define INIT_COUNTER( c, type, compute ) p_input->p->counters.p_##c = \ #define INIT_COUNTER( c, type, compute ) p_input->p->counters.p_##c = \
stats_CounterCreate( p_input, VLC_VAR_##type, STATS_##compute); stats_CounterCreate( VLC_VAR_##type, STATS_##compute);
if( libvlc_stats( p_input ) ) if( libvlc_stats( p_input ) )
{ {
INIT_COUNTER( read_bytes, INTEGER, COUNTER ); INIT_COUNTER( read_bytes, INTEGER, COUNTER );
...@@ -3202,7 +3202,7 @@ void input_UpdateStatistic( input_thread_t *p_input, ...@@ -3202,7 +3202,7 @@ void input_UpdateStatistic( input_thread_t *p_input,
vlc_mutex_lock( &p_input->p->counters.counters_lock); vlc_mutex_lock( &p_input->p->counters.counters_lock);
switch( i_type ) switch( i_type )
{ {
#define I(c) stats_UpdateInteger( p_input, p_input->p->counters.c, i_delta, NULL ) #define I(c) stats_UpdateInteger( p_input->p->counters.c, i_delta, NULL )
case INPUT_STATISTIC_DECODED_VIDEO: case INPUT_STATISTIC_DECODED_VIDEO:
I(p_decoded_video); I(p_decoded_video);
break; break;
...@@ -3220,8 +3220,8 @@ void input_UpdateStatistic( input_thread_t *p_input, ...@@ -3220,8 +3220,8 @@ void input_UpdateStatistic( input_thread_t *p_input,
{ {
int i_bytes; /* That's pretty stupid to define it as an integer, it will overflow int i_bytes; /* That's pretty stupid to define it as an integer, it will overflow
really fast ... */ really fast ... */
if( !stats_UpdateInteger( p_input, p_input->p->counters.p_sout_sent_bytes, i_delta, &i_bytes ) ) if( !stats_UpdateInteger( p_input->p->counters.p_sout_sent_bytes, i_delta, &i_bytes ) )
stats_UpdateFloat( p_input, p_input->p->counters.p_sout_send_bitrate, i_bytes, NULL ); stats_UpdateFloat( p_input->p->counters.p_sout_send_bitrate, i_bytes, NULL );
break; break;
} }
default: default:
......
...@@ -1690,11 +1690,11 @@ static int AReadStream( stream_t *s, void *p_read, unsigned int i_read ) ...@@ -1690,11 +1690,11 @@ static int AReadStream( stream_t *s, void *p_read, unsigned int i_read )
if( p_input ) if( p_input )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( s, p_input->p->counters.p_read_bytes, i_read, stats_UpdateInteger( p_input->p->counters.p_read_bytes, i_read,
&i_total ); &i_total );
stats_UpdateFloat( s, p_input->p->counters.p_input_bitrate, stats_UpdateFloat( p_input->p->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s, p_input->p->counters.p_read_packets, 1, NULL ); stats_UpdateInteger( p_input->p->counters.p_read_packets, 1, NULL );
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
} }
return i_read; return i_read;
...@@ -1730,10 +1730,10 @@ static int AReadStream( stream_t *s, void *p_read, unsigned int i_read ) ...@@ -1730,10 +1730,10 @@ static int AReadStream( stream_t *s, void *p_read, unsigned int i_read )
if( p_input ) if( p_input )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( s, p_input->p->counters.p_read_bytes, i_read, &i_total ); stats_UpdateInteger( p_input->p->counters.p_read_bytes, i_read, &i_total );
stats_UpdateFloat( s, p_input->p->counters.p_input_bitrate, stats_UpdateFloat( p_input->p->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s, p_input->p->counters.p_read_packets, 1, NULL ); stats_UpdateInteger( p_input->p->counters.p_read_packets, 1, NULL );
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
} }
return i_read; return i_read;
...@@ -1757,11 +1757,11 @@ static block_t *AReadBlock( stream_t *s, bool *pb_eof ) ...@@ -1757,11 +1757,11 @@ static block_t *AReadBlock( stream_t *s, bool *pb_eof )
if( p_input && p_block && libvlc_stats (p_access) ) if( p_input && p_block && libvlc_stats (p_access) )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( s, p_input->p->counters.p_read_bytes, stats_UpdateInteger( p_input->p->counters.p_read_bytes,
p_block->i_buffer, &i_total ); p_block->i_buffer, &i_total );
stats_UpdateFloat( s, p_input->p->counters.p_input_bitrate, stats_UpdateFloat( p_input->p->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s, p_input->p->counters.p_read_packets, 1, NULL ); stats_UpdateInteger( p_input->p->counters.p_read_packets, 1, NULL );
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
} }
return p_block; return p_block;
...@@ -1798,11 +1798,11 @@ static block_t *AReadBlock( stream_t *s, bool *pb_eof ) ...@@ -1798,11 +1798,11 @@ static block_t *AReadBlock( stream_t *s, bool *pb_eof )
if( p_input ) if( p_input )
{ {
vlc_mutex_lock( &p_input->p->counters.counters_lock ); vlc_mutex_lock( &p_input->p->counters.counters_lock );
stats_UpdateInteger( s, p_input->p->counters.p_read_bytes, stats_UpdateInteger( p_input->p->counters.p_read_bytes,
p_block->i_buffer, &i_total ); p_block->i_buffer, &i_total );
stats_UpdateFloat( s, p_input->p->counters.p_input_bitrate, stats_UpdateFloat( p_input->p->counters.p_input_bitrate,
(float)i_total, NULL ); (float)i_total, NULL );
stats_UpdateInteger( s, p_input->p->counters.p_read_packets, stats_UpdateInteger( p_input->p->counters.p_read_packets,
1 , NULL); 1 , NULL);
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); vlc_mutex_unlock( &p_input->p->counters.counters_lock );
} }
......
...@@ -222,67 +222,57 @@ void var_OptionParse (vlc_object_t *, const char *, bool trusted); ...@@ -222,67 +222,57 @@ void var_OptionParse (vlc_object_t *, const char *, bool trusted);
/* /*
* Stats stuff * Stats stuff
*/ */
int stats_Update (vlc_object_t*, counter_t *, vlc_value_t, vlc_value_t *); int stats_Update (counter_t *, vlc_value_t, vlc_value_t *);
counter_t * stats_CounterCreate (vlc_object_t*, int, int); counter_t * stats_CounterCreate (int, int);
#define stats_CounterCreate(a,b,c) stats_CounterCreate( VLC_OBJECT(a), b, c ) int stats_Get (counter_t *, vlc_value_t*);
int stats_Get (vlc_object_t*, counter_t *, vlc_value_t*);
#define stats_Get(a,b,c) stats_Get( VLC_OBJECT(a), b, c)
void stats_CounterClean (counter_t * ); void stats_CounterClean (counter_t * );
static inline int stats_GetInteger( vlc_object_t *p_obj, counter_t *p_counter, static inline int stats_GetInteger( counter_t *p_counter, int64_t *value )
int64_t *value )
{ {
int i_ret; int i_ret;
vlc_value_t val; val.i_int = 0; vlc_value_t val; val.i_int = 0;
if( !p_counter ) return VLC_EGENERIC; if( !p_counter ) return VLC_EGENERIC;
i_ret = stats_Get( p_obj, p_counter, &val ); i_ret = stats_Get( p_counter, &val );
*value = val.i_int; *value = val.i_int;
return i_ret; return i_ret;
} }
#define stats_GetInteger(a,b,c) stats_GetInteger( VLC_OBJECT(a), b, c )
static inline int stats_GetFloat( vlc_object_t *p_obj, counter_t *p_counter, static inline int stats_GetFloat( counter_t *p_counter, float *value )
float *value )
{ {
int i_ret; int i_ret;
vlc_value_t val; val.f_float = 0.0; vlc_value_t val; val.f_float = 0.0;
if( !p_counter ) return VLC_EGENERIC; if( !p_counter ) return VLC_EGENERIC;
i_ret = stats_Get( p_obj, p_counter, &val ); i_ret = stats_Get( p_counter, &val );
*value = val.f_float; *value = val.f_float;
return i_ret; return i_ret;
} }
#define stats_GetFloat(a,b,c) stats_GetFloat( VLC_OBJECT(a), b, c )
static inline int stats_UpdateInteger( vlc_object_t *p_obj,counter_t *p_co, static inline int stats_UpdateInteger( counter_t *p_co, int i, int *pi_new )
int i, int *pi_new )
{ {
int i_ret; int i_ret;
vlc_value_t val; vlc_value_t val;
vlc_value_t new_val; new_val.i_int = 0; vlc_value_t new_val; new_val.i_int = 0;
if( !p_co ) return VLC_EGENERIC; if( !p_co ) return VLC_EGENERIC;
val.i_int = i; val.i_int = i;
i_ret = stats_Update( p_obj, p_co, val, &new_val ); i_ret = stats_Update( p_co, val, &new_val );
if( pi_new ) if( pi_new )
*pi_new = new_val.i_int; *pi_new = new_val.i_int;
return i_ret; return i_ret;
} }
#define stats_UpdateInteger(a,b,c,d) stats_UpdateInteger( VLC_OBJECT(a),b,c,d )
static inline int stats_UpdateFloat( vlc_object_t *p_obj, counter_t *p_co, static inline int stats_UpdateFloat( counter_t *p_co, float f, float *pf_new )
float f, float *pf_new )
{ {
vlc_value_t val; vlc_value_t val;
int i_ret; int i_ret;
vlc_value_t new_val;new_val.f_float = 0.0; vlc_value_t new_val;new_val.f_float = 0.0;
if( !p_co ) return VLC_EGENERIC; if( !p_co ) return VLC_EGENERIC;
val.f_float = f; val.f_float = f;
i_ret = stats_Update( p_obj, p_co, val, &new_val ); i_ret = stats_Update( p_co, val, &new_val );
if( pf_new ) if( pf_new )
*pf_new = new_val.f_float; *pf_new = new_val.f_float;
return i_ret; return i_ret;
} }
#define stats_UpdateFloat(a,b,c,d) stats_UpdateFloat( VLC_OBJECT(a),b,c,d )
void stats_ComputeInputStats(input_thread_t*, input_stats_t*); void stats_ComputeInputStats(input_thread_t*, input_stats_t*);
void stats_ReinitInputStats(input_stats_t *); void stats_ReinitInputStats(input_stats_t *);
......
...@@ -37,18 +37,15 @@ ...@@ -37,18 +37,15 @@
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
static int CounterUpdate( vlc_object_t *p_this, static int CounterUpdate( counter_t *p_counter,
counter_t *p_counter,
vlc_value_t val, vlc_value_t * ); vlc_value_t val, vlc_value_t * );
/***************************************************************************** /*****************************************************************************
* Exported functions * Exported functions
*****************************************************************************/ *****************************************************************************/
#undef stats_CounterCreate
/** /**
* Create a statistics counter * Create a statistics counter
* \param p_this a VLC object
* \param i_type the type of stored data. One of VLC_VAR_STRING, * \param i_type the type of stored data. One of VLC_VAR_STRING,
* VLC_VAR_INTEGER, VLC_VAR_FLOAT * VLC_VAR_INTEGER, VLC_VAR_FLOAT
* \param i_compute_type the aggregation type. One of STATS_LAST (always * \param i_compute_type the aggregation type. One of STATS_LAST (always
...@@ -56,11 +53,9 @@ static int CounterUpdate( vlc_object_t *p_this, ...@@ -56,11 +53,9 @@ static int CounterUpdate( vlc_object_t *p_this,
* STATS_MAX (keep the maximum passed value), STATS_MIN, or STATS_DERIVATIVE * STATS_MAX (keep the maximum passed value), STATS_MIN, or STATS_DERIVATIVE
* (keep a time derivative of the value) * (keep a time derivative of the value)
*/ */
counter_t * stats_CounterCreate( vlc_object_t *p_this, counter_t * stats_CounterCreate( int i_type, int i_compute_type )
int i_type, int i_compute_type )
{ {
counter_t *p_counter = (counter_t*) malloc( sizeof( counter_t ) ) ; counter_t *p_counter = (counter_t*) malloc( sizeof( counter_t ) ) ;
(void)p_this;
if( !p_counter ) return NULL; if( !p_counter ) return NULL;
p_counter->i_compute_type = i_compute_type; p_counter->i_compute_type = i_compute_type;
...@@ -75,20 +70,18 @@ counter_t * stats_CounterCreate( vlc_object_t *p_this, ...@@ -75,20 +70,18 @@ counter_t * stats_CounterCreate( vlc_object_t *p_this,
} }
/** Update a counter element with new values /** Update a counter element with new values
* \param p_this a VLC object
* \param p_counter the counter to update * \param p_counter the counter to update
* \param val the vlc_value union containing the new value to aggregate. For * \param val the vlc_value union containing the new value to aggregate. For
* more information on how data is aggregated, \see stats_Create * more information on how data is aggregated, \see stats_Create
* \param val_new a pointer that will be filled with new data * \param val_new a pointer that will be filled with new data
*/ */
int stats_Update( vlc_object_t *p_this, counter_t *p_counter, int stats_Update( counter_t *p_counter,
vlc_value_t val, vlc_value_t *val_new ) vlc_value_t val, vlc_value_t *val_new )
{ {
if( !libvlc_stats (p_this) || !p_counter ) return VLC_EGENERIC; if( !p_counter ) return VLC_EGENERIC;
return CounterUpdate( p_this, p_counter, val, val_new ); return CounterUpdate( p_counter, val, val_new );
} }
#undef stats_Get
/** Get the aggregated value for a counter /** Get the aggregated value for a counter
* \param p_this an object * \param p_this an object
* \param p_counter the counter * \param p_counter the counter
...@@ -96,9 +89,9 @@ int stats_Update( vlc_object_t *p_this, counter_t *p_counter, ...@@ -96,9 +89,9 @@ int stats_Update( vlc_object_t *p_this, counter_t *p_counter,
* retrieved value * retrieved value
* \return an error code * \return an error code
*/ */
int stats_Get( vlc_object_t *p_this, counter_t *p_counter, vlc_value_t *val ) int stats_Get( counter_t *p_counter, vlc_value_t *val )
{ {
if( !libvlc_stats (p_this) || !p_counter || p_counter->i_samples == 0 ) if( !p_counter || p_counter->i_samples == 0 )
{ {
val->i_int = 0; val->i_int = 0;
return VLC_EGENERIC; return VLC_EGENERIC;
...@@ -158,48 +151,48 @@ void stats_ComputeInputStats( input_thread_t *p_input, input_stats_t *p_stats ) ...@@ -158,48 +151,48 @@ void stats_ComputeInputStats( input_thread_t *p_input, input_stats_t *p_stats )
vlc_mutex_lock( &p_stats->lock ); vlc_mutex_lock( &p_stats->lock );
/* Input */ /* Input */
stats_GetInteger( p_input, p_input->p->counters.p_read_packets, stats_GetInteger( p_input->p->counters.p_read_packets,
&p_stats->i_read_packets ); &p_stats->i_read_packets );
stats_GetInteger( p_input, p_input->p->counters.p_read_bytes, stats_GetInteger( p_input->p->counters.p_read_bytes,
&p_stats->i_read_bytes ); &p_stats->i_read_bytes );
stats_GetFloat( p_input, p_input->p->counters.p_input_bitrate, stats_GetFloat( p_input->p->counters.p_input_bitrate,
&p_stats->f_input_bitrate ); &p_stats->f_input_bitrate );
stats_GetInteger( p_input, p_input->p->counters.p_demux_read, stats_GetInteger( p_input->p->counters.p_demux_read,
&p_stats->i_demux_read_bytes ); &p_stats->i_demux_read_bytes );
stats_GetFloat( p_input, p_input->p->counters.p_demux_bitrate, stats_GetFloat( p_input->p->counters.p_demux_bitrate,
&p_stats->f_demux_bitrate ); &p_stats->f_demux_bitrate );
stats_GetInteger( p_input, p_input->p->counters.p_demux_corrupted, stats_GetInteger( p_input->p->counters.p_demux_corrupted,
&p_stats->i_demux_corrupted ); &p_stats->i_demux_corrupted );
stats_GetInteger( p_input, p_input->p->counters.p_demux_discontinuity, stats_GetInteger( p_input->p->counters.p_demux_discontinuity,
&p_stats->i_demux_discontinuity ); &p_stats->i_demux_discontinuity );
/* Decoders */ /* Decoders */
stats_GetInteger( p_input, p_input->p->counters.p_decoded_video, stats_GetInteger( p_input->p->counters.p_decoded_video,
&p_stats->i_decoded_video ); &p_stats->i_decoded_video );
stats_GetInteger( p_input, p_input->p->counters.p_decoded_audio, stats_GetInteger( p_input->p->counters.p_decoded_audio,
&p_stats->i_decoded_audio ); &p_stats->i_decoded_audio );
/* Sout */ /* Sout */
if( p_input->p->counters.p_sout_send_bitrate ) if( p_input->p->counters.p_sout_send_bitrate )
{ {
stats_GetInteger( p_input, p_input->p->counters.p_sout_sent_packets, stats_GetInteger( p_input->p->counters.p_sout_sent_packets,
&p_stats->i_sent_packets ); &p_stats->i_sent_packets );
stats_GetInteger( p_input, p_input->p->counters.p_sout_sent_bytes, stats_GetInteger( p_input->p->counters.p_sout_sent_bytes,
&p_stats->i_sent_bytes ); &p_stats->i_sent_bytes );
stats_GetFloat ( p_input, p_input->p->counters.p_sout_send_bitrate, stats_GetFloat ( p_input->p->counters.p_sout_send_bitrate,
&p_stats->f_send_bitrate ); &p_stats->f_send_bitrate );
} }
/* Aout */ /* Aout */
stats_GetInteger( p_input, p_input->p->counters.p_played_abuffers, stats_GetInteger( p_input->p->counters.p_played_abuffers,
&p_stats->i_played_abuffers ); &p_stats->i_played_abuffers );
stats_GetInteger( p_input, p_input->p->counters.p_lost_abuffers, stats_GetInteger( p_input->p->counters.p_lost_abuffers,
&p_stats->i_lost_abuffers ); &p_stats->i_lost_abuffers );
/* Vouts */ /* Vouts */
stats_GetInteger( p_input, p_input->p->counters.p_displayed_pictures, stats_GetInteger( p_input->p->counters.p_displayed_pictures,
&p_stats->i_displayed_pictures ); &p_stats->i_displayed_pictures );
stats_GetInteger( p_input, p_input->p->counters.p_lost_pictures, stats_GetInteger( p_input->p->counters.p_lost_pictures,
&p_stats->i_lost_pictures ); &p_stats->i_lost_pictures );
vlc_mutex_unlock( &p_stats->lock ); vlc_mutex_unlock( &p_stats->lock );
...@@ -251,8 +244,7 @@ void stats_CounterClean( counter_t *p_c ) ...@@ -251,8 +244,7 @@ void stats_CounterClean( counter_t *p_c )
* \param val the "new" value * \param val the "new" value
* \return an error code * \return an error code
*/ */
static int CounterUpdate( vlc_object_t *p_handler, static int CounterUpdate( counter_t *p_counter,
counter_t *p_counter,
vlc_value_t val, vlc_value_t *new_val ) vlc_value_t val, vlc_value_t *new_val )
{ {
switch( p_counter->i_compute_type ) switch( p_counter->i_compute_type )
...@@ -266,12 +258,6 @@ static int CounterUpdate( vlc_object_t *p_handler, ...@@ -266,12 +258,6 @@ static int CounterUpdate( vlc_object_t *p_handler,
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_counter->last_update = now; p_counter->last_update = now;
if( p_counter->i_type != VLC_VAR_FLOAT &&
p_counter->i_type != VLC_VAR_INTEGER )
{
msg_Err( p_handler, "Unable to compute DERIVATIVE for this type");
return VLC_EGENERIC;
}
/* Insert the new one at the beginning */ /* Insert the new one at the beginning */
p_new = (counter_sample_t*)malloc( sizeof( counter_sample_t ) ); p_new = (counter_sample_t*)malloc( sizeof( counter_sample_t ) );
p_new->value = val; p_new->value = val;
...@@ -288,11 +274,6 @@ static int CounterUpdate( vlc_object_t *p_handler, ...@@ -288,11 +274,6 @@ static int CounterUpdate( vlc_object_t *p_handler,
break; break;
} }
case STATS_COUNTER: case STATS_COUNTER:
if( p_counter->i_samples > 1)
{
msg_Err( p_handler, "LAST counter has several samples !" );
return VLC_EGENERIC;
}
if( p_counter->i_samples == 0 ) if( p_counter->i_samples == 0 )
{ {
counter_sample_t *p_new = (counter_sample_t*)malloc( counter_sample_t *p_new = (counter_sample_t*)malloc(
......
...@@ -2017,8 +2017,8 @@ static void httpd_ClientTlsHsOut( httpd_client_t *cl ) ...@@ -2017,8 +2017,8 @@ static void httpd_ClientTlsHsOut( httpd_client_t *cl )
static void* httpd_HostThread( void *data ) static void* httpd_HostThread( void *data )
{ {
httpd_host_t *host = data; httpd_host_t *host = data;
counter_t *p_total_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); counter_t *p_total_counter = stats_CounterCreate( VLC_VAR_INTEGER, STATS_COUNTER );
counter_t *p_active_counter = stats_CounterCreate( host, VLC_VAR_INTEGER, STATS_COUNTER ); counter_t *p_active_counter = stats_CounterCreate( VLC_VAR_INTEGER, STATS_COUNTER );
int evfd = vlc_object_waitpipe( VLC_OBJECT( host ) ); int evfd = vlc_object_waitpipe( VLC_OBJECT( host ) );
for( ;; ) for( ;; )
...@@ -2049,7 +2049,7 @@ static void* httpd_HostThread( void *data ) ...@@ -2049,7 +2049,7 @@ static void* httpd_HostThread( void *data )
cl->i_activity_date+cl->i_activity_timeout < now) ) ) ) cl->i_activity_date+cl->i_activity_timeout < now) ) ) )
{ {
httpd_ClientClean( cl ); httpd_ClientClean( cl );
stats_UpdateInteger( host, p_active_counter, -1, NULL ); stats_UpdateInteger( p_active_counter, -1, NULL );
TAB_REMOVE( host->i_client, host->client, cl ); TAB_REMOVE( host->i_client, host->client, cl );
free( cl ); free( cl );
i_client--; i_client--;
...@@ -2472,8 +2472,8 @@ static void* httpd_HostThread( void *data ) ...@@ -2472,8 +2472,8 @@ static void* httpd_HostThread( void *data )
else else
p_tls = NULL; p_tls = NULL;
stats_UpdateInteger( host, p_total_counter, 1, NULL ); stats_UpdateInteger( p_total_counter, 1, NULL );
stats_UpdateInteger( host, p_active_counter, 1, NULL ); stats_UpdateInteger( p_active_counter, 1, NULL );
cl = httpd_ClientNew( fd, p_tls, now ); cl = httpd_ClientNew( fd, p_tls, now );
vlc_mutex_lock( &host->lock ); vlc_mutex_lock( &host->lock );
TAB_APPEND( host->i_client, host->client, cl ); TAB_APPEND( host->i_client, host->client, cl );
......
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