]> git.sesse.net Git - vlc/blobdiff - src/misc/stats.c
use backtrace with vlc_object_get warning
[vlc] / src / misc / stats.c
index db058b2a8a03bf5e8ee7c3ed8acc6d24e7878042..d6302bd887cc9ca058b0c813834e940486e51a7a 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <stdio.h>                                               /* required */
 
-#include <assert.h>
-
 #include "input/input_internal.h"
 
 /*****************************************************************************
@@ -378,7 +376,6 @@ void __stats_TimerDump( vlc_object_t *p_obj, unsigned int i_id )
             break;
         }
     }
-    assert( p_counter );
     TimerDump( p_obj, p_counter, true );
     vlc_mutex_unlock( &priv->timer_lock );
 }
@@ -516,11 +513,12 @@ static int CounterUpdate( vlc_object_t *p_handler,
     case STATS_DERIVATIVE:
     {
         counter_sample_t *p_new, *p_old;
-        if( mdate() - p_counter->last_update < p_counter->update_interval )
+        mtime_t now = mdate();
+        if( now - p_counter->last_update < p_counter->update_interval )
         {
             return VLC_EGENERIC;
         }
-        p_counter->last_update = mdate();
+        p_counter->last_update = now;
         if( p_counter->i_type != VLC_VAR_FLOAT &&
             p_counter->i_type != VLC_VAR_INTEGER )
         {
@@ -584,7 +582,8 @@ static int CounterUpdate( vlc_object_t *p_handler,
 static void TimerDump( vlc_object_t *p_obj, counter_t *p_counter,
                        bool b_total )
 {
-    assert( p_counter );
+    if( !p_counter )
+        return;
 
     mtime_t last, total;
     int i_total;