[vlc-devel] [PATCH 15/15] modules: replace hardcoded CLOCK_FREQ fractions by VTICK_FROM_MILLI()

Steve Lhomme robux4 at ycbcr.xyz
Fri Jun 15 17:09:26 CEST 2018


---
 modules/access/live555.cpp                 | 2 +-
 modules/demux/adaptive/PlaylistManager.cpp | 8 ++++----
 modules/demux/asf/asf.c                    | 2 +-
 modules/demux/mp4/mp4.c                    | 2 +-
 modules/demux/sid.cpp                      | 2 +-
 modules/demux/smf.c                        | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 6f8c896292b..f1f9e8aca14 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -285,7 +285,7 @@ static unsigned char* parseVorbisConfigStr( char const* configStr,
 
 static char *passwordLessURL( vlc_url_t *url );
 
-#define PCR_OBS (CLOCK_FREQ / 4)
+#define PCR_OBS VTICK_FROM_MILLI(250)
 #define PCR_OFF PCR_OBS
 
 /*****************************************************************************
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 60a01a79664..ce658c78977 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -405,7 +405,7 @@ bool PlaylistManager::reactivateStream(AbstractStream *stream)
     return stream->reactivate(getResumeTime());
 }
 
-#define DEMUX_INCREMENT (CLOCK_FREQ / 20)
+#define DEMUX_INCREMENT VTICK_FROM_MILLI(50)
 int PlaylistManager::demux_callback(demux_t *p_demux)
 {
     PlaylistManager *manager = reinterpret_cast<PlaylistManager *>(p_demux->p_sys);
@@ -649,13 +649,13 @@ void PlaylistManager::Run()
         {
             mtime_t i_deadline = mdate();
             if(i_return == AbstractStream::buffering_ongoing)
-                i_deadline += (CLOCK_FREQ / 100);
+                i_deadline += VTICK_FROM_MILLI(10);
             else if(i_return == AbstractStream::buffering_full)
-                i_deadline += (CLOCK_FREQ / 10);
+                i_deadline += VTICK_FROM_MILLI(100);
             else if(i_return == AbstractStream::buffering_end)
                 i_deadline += (CLOCK_FREQ);
             else /*if(i_return == AbstractStream::buffering_suspended)*/
-                i_deadline += (CLOCK_FREQ / 4);
+                i_deadline += VTICK_FROM_MILLI(250);
 
             vlc_mutex_lock(&demux.lock);
             vlc_cond_signal(&demux.cond);
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index fb0100cf131..9789c6ed210 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -186,7 +186,7 @@ static int Open( vlc_object_t * p_this )
 /*****************************************************************************
  * Demux: read packet and send them to decoders
  *****************************************************************************/
-#define CHUNK (CLOCK_FREQ / 10)
+#define CHUNK VTICK_FROM_MILLI(100)
 static int Demux( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index eb6db258e68..32b37e4a989 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -143,7 +143,7 @@ typedef struct
     mp4_fragments_index_t *p_fragsindex;
 } demux_sys_t;
 
-#define DEMUX_INCREMENT (CLOCK_FREQ / 4) /* How far the pcr will go, each round */
+#define DEMUX_INCREMENT VTICK_FROM_MILLI(250) /* How far the pcr will go, each round */
 #define DEMUX_TRACK_MAX_PRELOAD VTICK_FROM_SEC(15) /* maximum preloading, to deal with interleaving */
 
 #define VLC_DEMUXER_EOS (VLC_DEMUXER_EGENERIC - 1)
diff --git a/modules/demux/sid.cpp b/modules/demux/sid.cpp
index aa87462e946..8be8fee9d8b 100644
--- a/modules/demux/sid.cpp
+++ b/modules/demux/sid.cpp
@@ -241,7 +241,7 @@ static int Control (demux_t *demux, int query, va_list args)
     {
         case DEMUX_GET_TIME : {
             int64_t *v = va_arg (args, int64_t*);
-            *v = sys->player->time() * sys->player->timebase() * (CLOCK_FREQ / 100);
+            *v = sys->player->time() * sys->player->timebase() * VTICK_FROM_MILLI(10);
             return VLC_SUCCESS;
         }
 
diff --git a/modules/demux/smf.c b/modules/demux/smf.c
index 7c8ac03b395..0012e979b40 100644
--- a/modules/demux/smf.c
+++ b/modules/demux/smf.c
@@ -431,7 +431,7 @@ static int ReadEvents (demux_t *demux, uint64_t *restrict pulse,
     return 0;
 }
 
-#define TICK (CLOCK_FREQ / 100)
+#define TICK VTICK_FROM_MILLI(10)
 
 /*****************************************************************************
  * Demux: read chunks and send them to the synthesizer
-- 
2.17.0



More information about the vlc-devel mailing list