Commit 60c51db9 authored by Clément Stenac's avatar Clément Stenac

Fix stats crash

parent 60a7a1fd
...@@ -162,7 +162,14 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id, char *psz_name, vlc_valu ...@@ -162,7 +162,14 @@ int __stats_Get( vlc_object_t *p_this, int i_object_id, char *psz_name, vlc_valu
*val = p_counter->pp_samples[0]->value; *val = p_counter->pp_samples[0]->value;
break; break;
case STATS_DERIVATIVE: case STATS_DERIVATIVE:
if( p_counter->i_type == VLC_VAR_INTEGER ) /* Not ready yet */
if( p_counter->i_samples < 2 )
{
vlc_mutex_unlock( &p_handler->object_lock );
val->i_int = 0; val->f_float = 0.0;
return VLC_EGENERIC;
}
if( p_counter->i_type == VLC_VAR_INTEGER )
{ {
float f = ( p_counter->pp_samples[0]->value.i_int - float f = ( p_counter->pp_samples[0]->value.i_int -
p_counter->pp_samples[1]->value.i_int ) / p_counter->pp_samples[1]->value.i_int ) /
......
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