]> git.sesse.net Git - vlc/commitdiff
stats: calculate dts difference if there is actually difference
authorIlkka Ollakka <ileoo@videolan.org>
Sat, 15 Feb 2014 17:28:25 +0000 (19:28 +0200)
committerIlkka Ollakka <ileoo@videolan.org>
Sat, 15 Feb 2014 17:28:54 +0000 (19:28 +0200)
modules/stream_out/stats.c

index b8f937975f4913beea5c2793b9b9e4ebea6ada00..1b0e9f737bcf816f8a2e2e194b1aeb3942776264 100644 (file)
@@ -226,16 +226,19 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
         /* We could just set p_sys->output to stdout and remove user of msg_Dbg
          * if we don't need ability to output info to gui modules (like qt4 messages window
          */
+        mtime_t dts_difference = VLC_TS_INVALID;
+        if( likely( id->previous_dts != VLC_TS_INVALID ) )
+            dts_difference = p_block->i_dts - id->previous_dts;
         if( p_sys->output )
         {
             /* Write data in a form that it's easy to plot for example with gnuplot*/
             fprintf( p_sys->output, "%s\t%d\t%s\t%"PRIu64"\t%"PRId64"\t%"PRId64"\t%16s\n",
-                  p_sys->prefix, id->id, id->type, ++id->segment_number, p_block->i_dts - id->previous_dts,
+                  p_sys->prefix, id->id, id->type, ++id->segment_number, dts_difference,
                   p_block->i_length, outputhash );
 
         } else {
             msg_Dbg( p_stream, "%s: track:%d type:%s segment_number:%"PRIu64" dts_difference:%"PRId64" length:%"PRId64" md5:%16s",
-                  p_sys->prefix, id->id, id->type, ++id->segment_number, p_block->i_dts - id->previous_dts,
+                  p_sys->prefix, id->id, id->type, ++id->segment_number, dts_difference,
                   p_block->i_length, outputhash );
         }
         free( outputhash );