[vlc-commits] stream_out: stats: display current track duration

Alexandre Janniaux git at videolan.org
Mon Jan 25 11:37:35 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Jan 21 15:12:17 2021 +0100| [8c620d8ba84aaefb10b5999b104ad8ed59339fc3] | committer: Alexandre Janniaux

stream_out: stats: display current track duration

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8c620d8ba84aaefb10b5999b104ad8ed59339fc3
---

 modules/stream_out/stats.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/stream_out/stats.c b/modules/stream_out/stats.c
index f05a048faa..4a1f24e860 100644
--- a/modules/stream_out/stats.c
+++ b/modules/stream_out/stats.c
@@ -131,6 +131,10 @@ static int Send( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
         vlc_tick_t dts_difference = VLC_TICK_INVALID;
         if( likely( id->previous_dts != VLC_TICK_INVALID ) )
             dts_difference = p_block->i_dts - id->previous_dts;
+
+        id->track_duration += p_block->i_length ? p_block->i_length : dts_difference;
+        id->previous_dts = p_block->i_dts;
+
         if( p_sys->output )
         {
             /* Write data in a form that it's easy to plot for example with gnuplot*/
@@ -139,12 +143,10 @@ static int Send( sout_stream_t *p_stream, void *_id, block_t *p_buffer )
                   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",
+            msg_Dbg( p_stream, "%s: track:%d type:%s segment_number:%"PRIu64" dts_difference:%"PRId64" length:%"PRId64" current_duration:%"PRId64" md5:%16s",
                   p_sys->prefix, id->id, id->type, ++id->segment_number, dts_difference,
-                  p_block->i_length, outputhash );
+                  p_block->i_length, id->track_duration, outputhash );
         }
-        id->track_duration += p_block->i_length ? p_block->i_length : dts_difference;
-        id->previous_dts = p_block->i_dts;
         p_block = p_block->p_next;
     }
     return VLC_SUCCESS;



More information about the vlc-commits mailing list