vlc | branch: master | Steve Lhomme <[email protected]> | Tue Jul 3 08:48:43 2018 +0200| [4caed13afe29fd6bf71055ea647465dd18986cf5] | committer: Steve Lhomme
module: replace hardcoded CLOCK_FREQ fractions by VLC_TICK_FROM_MS() > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4caed13afe29fd6bf71055ea647465dd18986cf5 --- modules/access/bluray.c | 2 +- modules/access/dtv/en50221.c | 6 +++--- modules/access/http/h2output_test.c | 4 ++-- modules/access/linsys/linsys_hdsdi.c | 2 +- modules/access/linsys/linsys_sdi.c | 2 +- modules/access/rtp/session.c | 4 ++-- modules/audio_output/audiotrack.c | 2 +- modules/audio_output/auhal.c | 2 +- modules/audio_output/wasapi.c | 2 +- modules/demux/adaptive/PlaylistManager.cpp | 6 +++--- modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp | 2 +- modules/demux/adaptive/plumbing/Demuxer.cpp | 2 +- modules/demux/flac.c | 2 +- modules/demux/image.c | 2 +- modules/demux/mpeg/es.c | 2 +- modules/demux/mpeg/ps.c | 2 +- modules/demux/mpeg/ts.c | 4 ++-- modules/demux/stl.c | 2 +- modules/demux/subtitle.c | 2 +- modules/demux/ttml.c | 2 +- modules/demux/vc1.c | 2 +- modules/hw/vdpau/display.c | 2 +- modules/mux/mpeg/ts.c | 2 +- modules/services_discovery/mtp.c | 2 +- modules/stream_out/chromecast/chromecast_ctrl.cpp | 2 +- modules/video_output/decklink.cpp | 2 +- modules/visualization/projectm.cpp | 2 +- 27 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/access/bluray.c b/modules/access/bluray.c index 00f39aed51..b43c095837 100644 --- a/modules/access/bluray.c +++ b/modules/access/bluray.c @@ -414,7 +414,7 @@ static void startBackground(demux_t *p_demux) } // XXX TODO: what would be correct timestamp ??? - p_block->i_dts = p_block->i_pts = vlc_tick_now() + CLOCK_FREQ/25; + p_block->i_dts = p_block->i_pts = vlc_tick_now() + VLC_TICK_FROM_MS(40); uint8_t *p = p_block->p_buffer; memset(p, 0, fmt.video.i_width * fmt.video.i_height); diff --git a/modules/access/dtv/en50221.c b/modules/access/dtv/en50221.c index 941f722f08..bd36f588c5 100644 --- a/modules/access/dtv/en50221.c +++ b/modules/access/dtv/en50221.c @@ -1884,7 +1884,7 @@ static int InitSlot( cam_t * p_cam, int i_slot ) if ( p_cam->pb_active_slot[i_slot] ) { - p_cam->i_timeout = CLOCK_FREQ / 10; + p_cam->i_timeout = VLC_TICK_FROM_MS(100); return VLC_SUCCESS; } @@ -1958,9 +1958,9 @@ cam_t *en50221_Init( vlc_object_t *obj, int fd ) } } - p_cam->i_timeout = CLOCK_FREQ / 10; + p_cam->i_timeout = VLC_TICK_FROM_MS(100); /* Wait a bit otherwise it doesn't initialize properly... */ - vlc_tick_sleep( CLOCK_FREQ / 10 ); + vlc_tick_sleep( VLC_TICK_FROM_MS(100) ); p_cam->i_next_event = 0; } else diff --git a/modules/access/http/h2output_test.c b/modules/access/http/h2output_test.c index b23a74b2bc..1faa155677 100644 --- a/modules/access/http/h2output_test.c +++ b/modules/access/http/h2output_test.c @@ -160,7 +160,7 @@ int main(void) assert(vlc_h2_output_send(out, frame(10)) == 0); for (unsigned char i = 11; vlc_h2_output_send(out, frame(i)) == 0; i++) - vlc_tick_sleep(CLOCK_FREQ/10); /* eventually, it should start failing */ + vlc_tick_sleep(VLC_TICK_FROM_MS(100)); /* eventually, it should start failing */ assert(vlc_h2_output_send(out, frame(0)) == -1); assert(vlc_h2_output_send_prio(out, frame(0)) == -1); vlc_h2_output_destroy(out); @@ -174,7 +174,7 @@ int main(void) vlc_sem_wait(&rx); for (unsigned char i = 1; vlc_h2_output_send_prio(out, frame(i)) == 0; i++) - vlc_tick_sleep(CLOCK_FREQ/10); + vlc_tick_sleep(VLC_TICK_FROM_MS(100)); assert(vlc_h2_output_send(out, frame(0)) == -1); assert(vlc_h2_output_send_prio(out, frame(0)) == -1); vlc_h2_output_destroy(out); diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c index 2f05f06a2a..62e11c50ba 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 (CLOCK_FREQ/2) +#define CLOCK_GAP VLC_TICK_FROM_MS(500) #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 70bca000a3..3c629bd767 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 (CLOCK_FREQ/2) +#define CLOCK_GAP VLC_TICK_FROM_MS(500) #define START_DATE INT64_C(4294967296) #define DEMUX_BUFFER_SIZE 1350000 diff --git a/modules/access/rtp/session.c b/modules/access/rtp/session.c index adc0d18877..6abf03af21 100644 --- a/modules/access/rtp/session.c +++ b/modules/access/rtp/session.c @@ -438,8 +438,8 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session, deadline = 0; /* no jitter estimate with no frequency :( */ /* Make sure we wait at least for 25 msec */ - if (deadline < (CLOCK_FREQ / 40)) - deadline = CLOCK_FREQ / 40; + if (deadline < VLC_TICK_FROM_MS(25)) + deadline = VLC_TICK_FROM_MS(25); /* Additionnaly, we implicitly wait for the packetization time * multiplied by the number of missing packets. block is the first diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c index f6fe0646cc..550cf0596b 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 (CLOCK_FREQ/2) // 500ms +#define AUDIOTIMESTAMP_INTERVAL_US VLC_TICK_FROM_MS(500) // 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 f85904750d..a9bf3af2f0 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) { - vlc_tick_t timeout = vlc_tick_now() + CLOCK_FREQ/2; + vlc_tick_t timeout = vlc_tick_now() + VLC_TICK_FROM_MS(500); if (vlc_cond_timedwait(&w.cond, &w.lock, timeout)) msg_Dbg(p_aout, "reached timeout"); } diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c index e130914d00..bcfd9555ae 100644 --- a/modules/audio_output/wasapi.c +++ b/modules/audio_output/wasapi.c @@ -197,7 +197,7 @@ static HRESULT Play(aout_stream_t *s, block_t *block) break; /* done */ /* Out of buffer space, sleep */ - vlc_tick_sleep(sys->frames * (CLOCK_FREQ / 2) / sys->rate); + vlc_tick_sleep(sys->frames * VLC_TICK_FROM_MS(500) / sys->rate); } IAudioRenderClient_Release(render); out: diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp index 84974552fa..d3f642737d 100644 --- a/modules/demux/adaptive/PlaylistManager.cpp +++ b/modules/demux/adaptive/PlaylistManager.cpp @@ -422,7 +422,7 @@ int PlaylistManager::doDemux(vlc_tick_t increment) for(it=streams.begin(); it!=streams.end(); ++it) b_dead &= !(*it)->canActivate(); if(!b_dead) - vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + CLOCK_FREQ / 20); + vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + VLC_TICK_FROM_MS(50)); vlc_mutex_unlock(&demux.lock); return (b_dead) ? AbstractStream::status_eof : AbstractStream::status_buffering; } @@ -464,7 +464,7 @@ int PlaylistManager::doDemux(vlc_tick_t increment) break; case AbstractStream::status_buffering: vlc_mutex_lock(&demux.lock); - vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + CLOCK_FREQ / 20); + vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + VLC_TICK_FROM_MS(50)); vlc_mutex_unlock(&demux.lock); break; case AbstractStream::status_discontinuity: @@ -479,7 +479,7 @@ int PlaylistManager::doDemux(vlc_tick_t increment) if( demux.i_nzpcr != VLC_TICK_INVALID && i_nzbarrier != demux.i_nzpcr ) { demux.i_nzpcr = i_nzbarrier; - vlc_tick_t pcr = VLC_TICK_0 + std::max(INT64_C(0), demux.i_nzpcr - CLOCK_FREQ / 10); + vlc_tick_t pcr = VLC_TICK_0 + std::max(INT64_C(0), demux.i_nzpcr - VLC_TICK_FROM_MS(100)); es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, 0, pcr); } vlc_mutex_unlock(&demux.lock); diff --git a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp index 1168fc7cfa..1b10eaf33a 100644 --- a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp +++ b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp @@ -86,7 +86,7 @@ void RateBasedAdaptationLogic::updateDownloadRate(const ID &, size_t size, vlc_t dllength += time; dlsize += size; - if(dllength < CLOCK_FREQ / 4) + if(dllength < VLC_TICK_FROM_MS(250)) return; const size_t bps = CLOCK_FREQ * dlsize * 8 / dllength; diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp index 54fdca1743..7c3e5edc73 100644 --- a/modules/demux/adaptive/plumbing/Demuxer.cpp +++ b/modules/demux/adaptive/plumbing/Demuxer.cpp @@ -240,7 +240,7 @@ bool SlaveDemuxer::create() int SlaveDemuxer::demux(vlc_tick_t nz_deadline) { /* Always call with increment or buffering will get slow stuck */ - vlc_tick_t i_next_demux_time = VLC_TICK_0 + nz_deadline + CLOCK_FREQ / 4; + vlc_tick_t i_next_demux_time = VLC_TICK_0 + nz_deadline + VLC_TICK_FROM_MS(250); if( demux_Control(p_demux, DEMUX_SET_NEXT_DEMUX_TIME, i_next_demux_time ) != VLC_SUCCESS ) { b_eof = true; diff --git a/modules/demux/flac.c b/modules/demux/flac.c index ce70620a69..e7f8d4e42d 100644 --- a/modules/demux/flac.c +++ b/modules/demux/flac.c @@ -310,7 +310,7 @@ static int RefineSeek( demux_t *p_demux, vlc_tick_t i_time, double i_bytemicrora { vlc_tick_t i_diff = p_block_out->i_dts - i_time; /* Not in acceptable approximation range */ - if( i_diff > CLOCK_FREQ / 10 && i_diff / i_bytemicrorate > i_frame_size ) + if( i_diff > VLC_TICK_FROM_MS(100) && i_diff / i_bytemicrorate > i_frame_size ) { i_highpos = i_start_pos; i_start_pos -= ( i_diff / i_bytemicrorate ); diff --git a/modules/demux/image.c b/modules/demux/image.c index ddc9901117..dc9df51e50 100644 --- a/modules/demux/image.c +++ b/modules/demux/image.c @@ -196,7 +196,7 @@ static int Demux(demux_t *demux) deadline = sys->pts_next; } else if (sys->is_realtime) { deadline = vlc_tick_now(); - const vlc_tick_t max_wait = CLOCK_FREQ / 50; + const vlc_tick_t max_wait = VLC_TICK_FROM_MS(20); if (deadline + max_wait < pts_first) { es_out_SetPCR(demux->out, deadline); /* That's ugly, but not yet easily fixable */ diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c index 892ac00d05..303601049f 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 > (CLOCK_FREQ/2) ) + if( p_sys->b_estimate_bitrate && p_sys->i_pts > VLC_TICK_FROM_MS(500) ) p_sys->i_bitrate_avg = 8 * CLOCK_FREQ * p_sys->i_bytes / (p_sys->i_pts - 1); p_sys->i_bytes += p_block_out->i_buffer; diff --git a/modules/demux/mpeg/ps.c b/modules/demux/mpeg/ps.c index 8ddc0b0834..aaa2425f91 100644 --- a/modules/demux/mpeg/ps.c +++ b/modules/demux/mpeg/ps.c @@ -598,7 +598,7 @@ static int Demux( demux_t *p_demux ) if( tk->fmt.i_cat == AUDIO_ES || tk->fmt.i_cat == VIDEO_ES ) { if( !p_sys->b_bad_scr && p_sys->i_pack_scr > 0 && p_pkt->i_pts > 0 && - p_sys->i_pack_scr > p_pkt->i_pts + CLOCK_FREQ / 4 ) + p_sys->i_pack_scr > p_pkt->i_pts + VLC_TICK_FROM_MS(250) ) { msg_Warn( p_demux, "Incorrect SCR timing in advance of %" PRId64 "ms, disabling", p_sys->i_pack_scr - p_pkt->i_pts / 1000 ); diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c index c3a855d293..26c2fd1d04 100644 --- a/modules/demux/mpeg/ts.c +++ b/modules/demux/mpeg/ts.c @@ -1978,7 +1978,7 @@ static int SeekToTime( demux_t *p_demux, const ts_pmt_t *p_pmt, stime_t i_scaled stime_t i_diff = i_scaledtime - TimeStampWrapAround( p_pmt->pcr.i_first, i_pcr ); if ( i_diff < 0 ) i_tail_pos = (i_splitpos >= p_sys->i_packet_size) ? i_splitpos - p_sys->i_packet_size : 0; - else if( i_diff < TO_SCALE(VLC_TICK_0 + CLOCK_FREQ / 2) ) // 500ms + else if( i_diff < TO_SCALE(VLC_TICK_0 + VLC_TICK_FROM_MS(500)) ) b_found = true; else i_head_pos = i_pos; @@ -2401,7 +2401,7 @@ static void PCRFixHandle( demux_t *p_demux, ts_pmt_t *p_pmt, block_t *p_block ) { p_pmt->pcr.i_first_dts = TO_SCALE(p_block->i_dts); } - else if( p_block->i_dts - FROM_SCALE(p_pmt->pcr.i_first_dts) > CLOCK_FREQ / 2 ) /* "PCR repeat rate shall not exceed 100ms" */ + else if( p_block->i_dts - FROM_SCALE(p_pmt->pcr.i_first_dts) > VLC_TICK_FROM_MS(500) ) /* "PCR repeat rate shall not exceed 100ms" */ { if( p_pmt->pcr.i_current < 0 && GetPID( p_sys, p_pmt->i_pid_pcr )->probed.i_pcr_count == 0 ) diff --git a/modules/demux/stl.c b/modules/demux/stl.c index 4b7d35dde9..11dbb5ed4e 100644 --- a/modules/demux/stl.c +++ b/modules/demux/stl.c @@ -221,7 +221,7 @@ static int Demux(demux_t *demux) if (!sys->b_slave) { es_out_SetPCR(demux->out, VLC_TICK_0 + i_barrier); - sys->next_date += CLOCK_FREQ / 8; + sys->next_date += VLC_TICK_FROM_MS(125); } return sys->current < sys->count ? VLC_DEMUXER_SUCCESS : VLC_DEMUXER_EOF; diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c index 08f6e54f17..c26515a25a 100644 --- a/modules/demux/subtitle.c +++ b/modules/demux/subtitle.c @@ -886,7 +886,7 @@ static int Demux( demux_t *p_demux ) if ( !p_sys->b_slave ) { es_out_SetPCR( p_demux->out, VLC_TICK_0 + i_barrier ); - p_sys->i_next_demux_date += CLOCK_FREQ / 8; + p_sys->i_next_demux_date += VLC_TICK_FROM_MS(125); } if( p_sys->subtitles.i_current >= p_sys->subtitles.i_count ) diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c index dbbc11e818..67643918a9 100644 --- a/modules/demux/ttml.c +++ b/modules/demux/ttml.c @@ -386,7 +386,7 @@ static int Demux( demux_t* p_demux ) if ( !p_sys->b_slave ) { es_out_SetPCR( p_demux->out, VLC_TICK_0 + p_sys->i_next_demux_time ); - p_sys->i_next_demux_time += CLOCK_FREQ / 8; + p_sys->i_next_demux_time += VLC_TICK_FROM_MS(125); } if( p_sys->times.i_current + 1 >= p_sys->times.i_count ) diff --git a/modules/demux/vc1.c b/modules/demux/vc1.c index 8a5d1d5084..069cc39a39 100644 --- a/modules/demux/vc1.c +++ b/modules/demux/vc1.c @@ -186,7 +186,7 @@ static int Demux( demux_t *p_demux) else if( p_sys->f_fps > 0.001f ) p_sys->i_dts += (int64_t)((float) CLOCK_FREQ / p_sys->f_fps); else - p_sys->i_dts += CLOCK_FREQ / 25; + p_sys->i_dts += VLC_TICK_FROM_MS(40); } } diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c index 80b57d70fe..32afb6b76f 100644 --- a/modules/hw/vdpau/display.c +++ b/modules/hw/vdpau/display.c @@ -279,7 +279,7 @@ static void Queue(vout_display_t *vd, picture_t *pic, subpicture_t *subpic, if (unlikely(delay > CLOCK_FREQ)) { /* We would get stuck if the delay was too long. */ msg_Dbg(vd, "picture date corrupt: delay of %"PRId64" us", delay); - delay = CLOCK_FREQ / 50; + delay = VLC_TICK_FROM_MS(20); } pts += delay * 1000; diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index fbeaa87126..e3c4fd8cd9 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -1256,7 +1256,7 @@ static bool MuxStreams(sout_mux_t *p_mux ) continue; if ( ( i_spu_delay >= 100 * CLOCK_FREQ ) || - ( i_spu_delay < CLOCK_FREQ / 100 ) ) + ( i_spu_delay < VLC_TICK_FROM_MS(10) ) ) { BufferChainClean( &p_stream->state.chain_pes ); p_stream->state.i_pes_dts = 0; diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c index 8831ec1b31..5f4f9d472a 100644 --- a/modules/services_discovery/mtp.c +++ b/modules/services_discovery/mtp.c @@ -170,7 +170,7 @@ static void *Run( void *data ) i_status = 0; } else - vlc_tick_sleep( CLOCK_FREQ/2 ); + vlc_tick_sleep( VLC_TICK_FROM_MS(500) ); } return NULL; } diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp index c8262c5146..465ccaf6fb 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; - vlc_tick_t deadline = vlc_tick_now() + CLOCK_FREQ/2; + vlc_tick_t deadline = vlc_tick_now() + VLC_TICK_FROM_MS(500); /* 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 diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp index 015cb3fc3d..75b546ceda 100644 --- a/modules/video_output/decklink.cpp +++ b/modules/video_output/decklink.cpp @@ -302,7 +302,7 @@ static decklink_sys_t *HoldDLSys(vlc_object_t *obj, int i_cat) { vlc_mutex_unlock(&sys_lock); msg_Info(obj, "Waiting for previous vout module to exit"); - vlc_tick_sleep(CLOCK_FREQ / 10); + vlc_tick_sleep(VLC_TICK_FROM_MS(100)); vlc_mutex_lock(&sys_lock); } } diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp index 4f0d7c564a..443ada348e 100644 --- a/modules/visualization/projectm.cpp +++ b/modules/visualization/projectm.cpp @@ -347,7 +347,7 @@ static void *Thread( void *p_data ) /* */ for( ;; ) { - const vlc_tick_t i_deadline = vlc_tick_now() + CLOCK_FREQ / 50; /* 50 fps max */ + const vlc_tick_t i_deadline = vlc_tick_now() + VLC_TICK_FROM_MS(20); /* 50 fps max */ /* Manage the events */ unsigned width, height; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
