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

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


---
 src/input/demux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index db1b46532ea..55ffbb51655 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -316,7 +316,7 @@ int demux_vaControlHelper( stream_t *s,
         case DEMUX_GET_LENGTH:
             if( i_bitrate > 0 && i_end > i_start )
             {
-                *va_arg( args, vlc_tick_t * ) = INT64_C(8000000) * (i_end - i_start) / i_bitrate;
+                *va_arg( args, vlc_tick_t * ) = vlc_tick_from_samples((i_end - i_start) * 8, i_bitrate);
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -324,7 +324,7 @@ int demux_vaControlHelper( stream_t *s,
         case DEMUX_GET_TIME:
             if( i_bitrate > 0 && i_tell >= i_start )
             {
-                *va_arg( args, vlc_tick_t * ) = INT64_C(8000000) * (i_tell - i_start) / i_bitrate;
+                *va_arg( args, vlc_tick_t * ) = vlc_tick_from_samples((i_tell - i_start) * 8, i_bitrate);
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
-- 
2.26.2



More information about the vlc-devel mailing list