[vlc-devel] [PATCH 3/8] demux: es: use vlc_tick_from_samples instead of hardcoded values

Steve Lhomme robux4 at ycbcr.xyz
Thu Aug 13 14:12:16 CEST 2020


---
 modules/demux/mpeg/es.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index ac5924f3140..73449bf2a2d 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -585,9 +585,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     {
         if( p_sys->i_bitrate_avg > 0 )
         {
-            int64_t i_time = INT64_C(8000000)
-                * ( vlc_stream_Tell(p_demux->s) - p_sys->i_stream_offset )
-                / p_sys->i_bitrate_avg;
+            vlc_tick_t i_time = vlc_tick_from_samples(
+                ( vlc_stream_Tell(p_demux->s) - p_sys->i_stream_offset ) * 8
+                , p_sys->i_bitrate_avg );
 
             /* Fix time_offset */
             if( i_time >= 0 )
-- 
2.26.2



More information about the vlc-devel mailing list