[vlc-commits] core: fix VLC_TS_INVALID tests
Steve Lhomme
git at videolan.org
Wed May 2 18:42:12 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed May 2 16:02:49 2018 +0200| [28180787f93e9274f0a5168e239cc82371ac009c] | committer: Steve Lhomme
core: fix VLC_TS_INVALID tests
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=28180787f93e9274f0a5168e239cc82371ac009c
---
src/input/clock.c | 10 +++++-----
src/input/decoder.c | 28 ++++++++++++++--------------
src/input/es_out.c | 4 ++--
src/video_output/control.c | 2 +-
src/video_output/video_output.c | 12 ++++++------
5 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/input/clock.c b/src/input/clock.c
index e1cc0fc0ae..8b6501f037 100644
--- a/src/input/clock.c
+++ b/src/input/clock.c
@@ -243,7 +243,7 @@ void input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
{
bool b_reset_reference = false;
- assert( i_ck_stream > VLC_TS_INVALID && i_ck_system > VLC_TS_INVALID );
+ assert( i_ck_stream != VLC_TS_INVALID && i_ck_system != VLC_TS_INVALID );
vlc_mutex_lock( &cl->lock );
@@ -252,7 +252,7 @@ void input_clock_Update( input_clock_t *cl, vlc_object_t *p_log,
/* */
b_reset_reference= true;
}
- else if( cl->last.i_stream > VLC_TS_INVALID &&
+ else if( cl->last.i_stream != VLC_TS_INVALID &&
( (cl->last.i_stream - i_ck_stream) > CR_MAX_GAP ||
(cl->last.i_stream - i_ck_stream) < -CR_MAX_GAP ) )
{
@@ -430,7 +430,7 @@ int input_clock_ConvertTS( vlc_object_t *p_object, input_clock_t *cl,
const mtime_t i_ts_delay = cl->i_pts_delay + ClockGetTsOffset( cl );
/* */
- if( *pi_ts0 > VLC_TS_INVALID )
+ if( *pi_ts0 != VLC_TS_INVALID )
{
*pi_ts0 = ClockStreamToSystem( cl, *pi_ts0 + AvgGet( &cl->drift ) );
if( *pi_ts0 > cl->i_ts_max )
@@ -439,7 +439,7 @@ int input_clock_ConvertTS( vlc_object_t *p_object, input_clock_t *cl,
}
/* XXX we do not update i_ts_max on purpose */
- if( pi_ts1 && *pi_ts1 > VLC_TS_INVALID )
+ if( pi_ts1 && *pi_ts1 != VLC_TS_INVALID )
{
*pi_ts1 = ClockStreamToSystem( cl, *pi_ts1 + AvgGet( &cl->drift ) ) +
i_ts_delay;
@@ -448,7 +448,7 @@ int input_clock_ConvertTS( vlc_object_t *p_object, input_clock_t *cl,
vlc_mutex_unlock( &cl->lock );
/* Check ts validity */
- if (i_ts_bound != INT64_MAX && *pi_ts0 > VLC_TS_INVALID) {
+ if (i_ts_bound != INT64_MAX && *pi_ts0 != VLC_TS_INVALID) {
if (*pi_ts0 >= mdate() + i_ts_delay + i_ts_buffering + i_ts_bound) {
msg_Err(p_object,
"Timestamp conversion failed (delay %"PRId64", buffering "
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 1a02d22672..ef43431211 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -623,7 +623,7 @@ static mtime_t DecoderGetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
i_ts = VLC_TS_INVALID;
vlc_mutex_unlock( &p_owner->lock );
- if( !p_owner->p_clock || i_ts <= VLC_TS_INVALID )
+ if( !p_owner->p_clock || i_ts == VLC_TS_INVALID )
return i_ts;
if( input_clock_ConvertTS( VLC_OBJECT(p_dec), p_owner->p_clock, NULL, &i_ts, NULL, INT64_MAX ) ) {
@@ -759,9 +759,9 @@ static inline void DecoderUpdatePreroll( int64_t *pi_preroll, const block_t *p )
else if( (p->i_flags & BLOCK_FLAG_DISCONTINUITY) &&
(p->i_buffer == 0 || (p->i_flags & BLOCK_FLAG_CORRUPTED)) )
*pi_preroll = INT64_MAX;
- else if( p->i_dts > VLC_TS_INVALID )
+ else if( p->i_dts != VLC_TS_INVALID )
*pi_preroll = __MIN( *pi_preroll, p->i_dts );
- else if( p->i_pts > VLC_TS_INVALID )
+ else if( p->i_pts != VLC_TS_INVALID )
*pi_preroll = __MIN( *pi_preroll, p->i_pts );
}
@@ -781,10 +781,10 @@ static void DecoderFixTs( decoder_t *p_dec, mtime_t *pi_ts0, mtime_t *pi_ts1,
const bool b_ephemere = pi_ts1 && *pi_ts0 == *pi_ts1;
int i_rate;
- if( *pi_ts0 > VLC_TS_INVALID )
+ if( *pi_ts0 != VLC_TS_INVALID )
{
*pi_ts0 += i_es_delay;
- if( pi_ts1 && *pi_ts1 > VLC_TS_INVALID )
+ if( pi_ts1 && *pi_ts1 != VLC_TS_INVALID )
*pi_ts1 += i_es_delay;
if( i_ts_bound != INT64_MAX )
i_ts_bound += i_es_delay;
@@ -1010,7 +1010,7 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
vout_Flush( p_vout, VLC_TS_INVALID+1 );
}
- if( p_picture->date <= VLC_TS_INVALID )
+ if( p_picture->date == VLC_TS_INVALID )
{
msg_Warn( p_dec, "non-dated video buffer received" );
goto discard;
@@ -1036,7 +1036,7 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
p_picture->b_force = true;
}
- const bool b_dated = p_picture->date > VLC_TS_INVALID;
+ const bool b_dated = p_picture->date != VLC_TS_INVALID;
int i_rate = INPUT_RATE_DEFAULT;
DecoderFixTs( p_dec, &p_picture->date, NULL, NULL,
&i_rate, DECODER_BOGUS_VIDEO_DELAY );
@@ -1054,7 +1054,7 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
if( p_vout == NULL )
goto discard;
- if( p_picture->b_force || p_picture->date > VLC_TS_INVALID )
+ if( p_picture->b_force || p_picture->date != VLC_TS_INVALID )
/* FIXME: VLC_TS_INVALID -- verify video_output */
{
if( i_rate != p_owner->i_last_rate || b_first_after_wait )
@@ -1153,7 +1153,7 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
}
/* */
- if( p_audio->i_pts <= VLC_TS_INVALID ) // FIXME --VLC_TS_INVALID verify audio_output/*
+ if( p_audio->i_pts == VLC_TS_INVALID ) // FIXME --VLC_TS_INVALID verify audio_output/*
{
msg_Warn( p_dec, "non-dated audio buffer received" );
*pi_lost_sum += 1;
@@ -1179,7 +1179,7 @@ static int DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio,
audio_output_t *p_aout = p_owner->p_aout;
- if( p_aout != NULL && p_audio->i_pts > VLC_TS_INVALID
+ if( p_aout != NULL && p_audio->i_pts != VLC_TS_INVALID
&& i_rate >= INPUT_RATE_DEFAULT/AOUT_MAX_INPUT_RATE
&& i_rate <= INPUT_RATE_DEFAULT*AOUT_MAX_INPUT_RATE
&& !DecoderTimedWait( p_dec, p_audio->i_pts - AOUT_MAX_PREPARE_TIME ) )
@@ -1256,7 +1256,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic )
vout_thread_t *p_vout = p_owner->p_spu_vout;
/* */
- if( p_subpic->i_start <= VLC_TS_INVALID )
+ if( p_subpic->i_start == VLC_TS_INVALID )
{
msg_Warn( p_dec, "non-dated spu buffer received" );
subpicture_Delete( p_subpic );
@@ -1277,7 +1277,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic )
NULL, INT64_MAX );
vlc_mutex_unlock( &p_owner->lock );
- if( p_subpic->i_start <= VLC_TS_INVALID
+ if( p_subpic->i_start == VLC_TS_INVALID
|| DecoderTimedWait( p_dec, p_subpic->i_start - SPU_MAX_PREPARE_TIME ) )
{
subpicture_Delete( p_subpic );
@@ -1304,9 +1304,9 @@ static int DecoderQueueSpu( decoder_t *p_dec, subpicture_t *p_spu )
{
/* Preroll does not work very well with subtitle */
vlc_mutex_lock( &p_owner->lock );
- if( p_spu->i_start > VLC_TS_INVALID &&
+ if( p_spu->i_start != VLC_TS_INVALID &&
p_spu->i_start < p_owner->i_preroll_end &&
- ( p_spu->i_stop <= VLC_TS_INVALID || p_spu->i_stop < p_owner->i_preroll_end ) )
+ ( p_spu->i_stop == VLC_TS_INVALID || p_spu->i_stop < p_owner->i_preroll_end ) )
{
vlc_mutex_unlock( &p_owner->lock );
subpicture_Delete( p_spu );
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1c82e023ec..61ad913c94 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2069,7 +2069,7 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
if( p_sys->i_preroll_end >= 0 )
{
int64_t i_date = p_block->i_pts;
- if( p_block->i_pts <= VLC_TS_INVALID )
+ if( p_block->i_pts == VLC_TS_INVALID )
i_date = p_block->i_dts;
if( i_date + p_block->i_length < p_sys->i_preroll_end )
@@ -2477,7 +2477,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return VLC_EGENERIC;
i_pcr = va_arg( args, int64_t );
- if( i_pcr <= VLC_TS_INVALID )
+ if( i_pcr == VLC_TS_INVALID )
{
msg_Err( p_sys->p_input, "Invalid PCR value in ES_OUT_SET_(GROUP_)PCR !" );
return VLC_EGENERIC;
diff --git a/src/video_output/control.c b/src/video_output/control.c
index e4cca29d2a..f60b3fc371 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -185,7 +185,7 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
vlc_cond_broadcast(&ctrl->wait_acknowledge);
/* Spurious wakeups are perfectly fine */
- if (deadline > VLC_TS_INVALID && ctrl->can_sleep)
+ if (deadline != VLC_TS_INVALID && ctrl->can_sleep)
vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, deadline);
}
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 566dd5078a..f032269160 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1219,7 +1219,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, mtime_t *deadline)
bool refresh = false;
mtime_t date_refresh = VLC_TS_INVALID;
- if (vout->p->displayed.date > VLC_TS_INVALID) {
+ if (vout->p->displayed.date != VLC_TS_INVALID) {
date_refresh = vout->p->displayed.date + VOUT_REDISPLAY_DELAY - render_delay;
refresh = date_refresh <= date;
}
@@ -1293,9 +1293,9 @@ static void ThreadChangePause(vout_thread_t *vout, bool is_paused, mtime_t date)
if (vout->p->pause.is_on) {
const mtime_t duration = date - vout->p->pause.date;
- if (vout->p->step.timestamp > VLC_TS_INVALID)
+ if (vout->p->step.timestamp != VLC_TS_INVALID)
vout->p->step.timestamp += duration;
- if (vout->p->step.last > VLC_TS_INVALID)
+ if (vout->p->step.last != VLC_TS_INVALID)
vout->p->step.last += duration;
picture_fifo_OffsetDate(vout->p->decoder_fifo, duration);
if (vout->p->displayed.decoded)
@@ -1342,7 +1342,7 @@ static void ThreadStep(vout_thread_t *vout, mtime_t *duration)
{
*duration = 0;
- if (vout->p->step.last <= VLC_TS_INVALID)
+ if (vout->p->step.last == VLC_TS_INVALID)
vout->p->step.last = vout->p->displayed.timestamp;
if (ThreadDisplayPicture(vout, NULL))
@@ -1350,7 +1350,7 @@ static void ThreadStep(vout_thread_t *vout, mtime_t *duration)
vout->p->step.timestamp = vout->p->displayed.timestamp;
- if (vout->p->step.last > VLC_TS_INVALID &&
+ if (vout->p->step.last != VLC_TS_INVALID &&
vout->p->step.timestamp > vout->p->step.last) {
*duration = vout->p->step.timestamp - vout->p->step.last;
vout->p->step.last = vout->p->step.timestamp;
@@ -1798,7 +1798,7 @@ static void *Thread(void *object)
if (wait)
{
const mtime_t max_deadline = mdate() + 100000;
- deadline = deadline <= VLC_TS_INVALID ? max_deadline : __MIN(deadline, max_deadline);
+ deadline = deadline == VLC_TS_INVALID ? max_deadline : __MIN(deadline, max_deadline);
} else {
deadline = VLC_TS_INVALID;
}
More information about the vlc-commits
mailing list