[vlc-commits] modules: use CLOCK_FREQ/2 instead of 500000 mtime_t

Steve Lhomme git at videolan.org
Fri May 4 10:38:03 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May  3 14:25:57 2018 +0200| [5a70cb3ccb2db36a6d9301e9059baadcbad3f8ad] | committer: Rémi Denis-Courmont

modules: use CLOCK_FREQ/2 instead of 500000 mtime_t

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/access/linsys/linsys_hdsdi.c              | 2 +-
 modules/access/linsys/linsys_sdi.c                | 2 +-
 modules/access/live555.cpp                        | 4 ++--
 modules/access/screen/screen.c                    | 2 +-
 modules/audio_output/audiotrack.c                 | 2 +-
 modules/audio_output/auhal.c                      | 2 +-
 modules/demux/mpeg/es.c                           | 2 +-
 modules/services_discovery/mtp.c                  | 4 ++--
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 2 +-
 9 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index f96009b94f..25f0aad76d 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -61,7 +61,7 @@
 #define SDIAUDIO_SAMPLESIZE_FILE "/sys/class/sdiaudio/sdiaudiorx%u/sample_size"
 #define SDIAUDIO_CHANNELS_FILE  "/sys/class/sdiaudio/sdiaudiorx%u/channels"
 #define NB_VBUFFERS             2
-#define CLOCK_GAP               INT64_C(500000)
+#define CLOCK_GAP               (CLOCK_FREQ/2)
 #define START_DATE              INT64_C(4294967296)
 
 #define MAX_AUDIOS              4
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index 6fe5f30770..5bad1682cd 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -55,7 +55,7 @@
 #define SDI_MODE_FILE     "/sys/class/sdi/sdirx%u/mode"
 #define READ_TIMEOUT      80000
 #define RESYNC_TIMEOUT    500000
-#define CLOCK_GAP         INT64_C(500000)
+#define CLOCK_GAP         (CLOCK_FREQ/2)
 #define START_DATE        INT64_C(4294967296)
 
 #define DEMUX_BUFFER_SIZE 1350000
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 88a1b3d225..dddd7496ea 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -1518,7 +1518,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pi64 = va_arg( args, int64_t * );
             if( p_sys->f_npt > 0 )
             {
-                *pi64 = (int64_t)(p_sys->f_npt * CLOCK_FREQ);
+                *pi64 = (int64_t)(p_sys->f_npt * (double)CLOCK_FREQ);
                 return VLC_SUCCESS;
             }
             return VLC_EGENERIC;
@@ -1527,7 +1527,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pi64 = va_arg( args, int64_t * );
             if( p_sys->f_npt_length > 0 )
             {
-                double d_length = p_sys->f_npt_length * CLOCK_FREQ;
+                double d_length = p_sys->f_npt_length * (double)CLOCK_FREQ;
                 if( d_length >= INT64_MAX )
                     *pi64 = INT64_MAX;
                 else
diff --git a/modules/access/screen/screen.c b/modules/access/screen/screen.c
index c686d639c6..13d8fce812 100644
--- a/modules/access/screen/screen.c
+++ b/modules/access/screen/screen.c
@@ -155,7 +155,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_ENOMEM;
 
     p_sys->f_fps = var_CreateGetFloat( p_demux, "screen-fps" );
-    p_sys->i_incr = CLOCK_FREQ / p_sys->f_fps;;
+    p_sys->i_incr = CLOCK_FREQ / p_sys->f_fps;
     p_sys->i_next_date = 0;
 
 #ifdef SCREEN_SUBSCREEN
diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index db51da3dbe..934826d3c7 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -38,7 +38,7 @@
 #define SMOOTHPOS_SAMPLE_COUNT 10
 #define SMOOTHPOS_INTERVAL_US INT64_C(30000) // 30ms
 
-#define AUDIOTIMESTAMP_INTERVAL_US INT64_C(500000) // 500ms
+#define AUDIOTIMESTAMP_INTERVAL_US (CLOCK_FREQ/2) // 500ms
 
 static int  Open( vlc_object_t * );
 static void Close( vlc_object_t * );
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 53e111b7d8..f160ea5e44 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -842,7 +842,7 @@ AudioStreamChangeFormat(audio_output_t *p_aout, AudioStreamID i_stream_id,
          * set. */
         if (i > 0)
         {
-            mtime_t timeout = mdate() + 500000;
+            mtime_t timeout = mdate() + CLOCK_FREQ/2;
             if (vlc_cond_timedwait(&w.cond, &w.lock, timeout))
                 msg_Dbg(p_aout, "reached timeout");
         }
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 1918160cd8..9f5e4d2e2b 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -350,7 +350,7 @@ static int Demux( demux_t *p_demux )
             es_out_SetPCR( p_demux->out, p_block_out->i_dts );
         }
         /* Re-estimate bitrate */
-        if( p_sys->b_estimate_bitrate && p_sys->i_pts > INT64_C(500000) )
+        if( p_sys->b_estimate_bitrate && p_sys->i_pts > (CLOCK_FREQ/2) )
             p_sys->i_bitrate_avg = 8*1000000*p_sys->i_bytes/(p_sys->i_pts-1);
         p_sys->i_bytes += p_block_out->i_buffer;
 
diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c
index e56ea3f7ae..8f52d31809 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -166,11 +166,11 @@ static void *Run( void *data )
         vlc_restorecancel(canc);
         if( i_status == 2 )
         {
-            msleep( 5000000 );
+            msleep( 5*CLOCK_FREQ );
             i_status = 0;
         }
         else
-            msleep( 500000 );
+            msleep( CLOCK_FREQ/2 );
     }
     return NULL;
 }
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 1977fa975b..3e157e7f5e 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -492,7 +492,7 @@ int intf_sys_t::pace()
     m_interrupted = false;
     vlc_interrupt_register( interrupt_wake_up_cb, this );
     int ret = 0;
-    mtime_t deadline = mdate() + INT64_C(500000);
+    mtime_t deadline = mdate() + CLOCK_FREQ/2;
 
     /* Wait for the sout to send more data via http (m_pace), or wait for the
      * CC to finish. In case the demux filter is EOF, we always wait for



More information about the vlc-commits mailing list