[vlc-devel] [RFC-PATCH 01/12] core: changed the type of decoder_owner_sys_t.i_preroll_end
Filip Roséen
filip at videolabs.io
Wed May 11 18:56:46 CEST 2016
This patch includes minor changes to the way i_preroll_end inside
decoder.{h,c} is handled, including:
- i_preroll_end is used to denote the vlc timestamp where prerolling of
the decoder should end, it only makes sense to change its type from
"int64_t" to "mtime_t" (even though mtime_t currently is an alias for
int64_t).
- When dealing with the data-members valid vs invalid states, the
VLC_TS_{INVALID,0} helper constants will allow for an implementation
that is easier to read.
---
src/input/decoder.c | 4 ++--
src/input/es_out.c | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/input/decoder.c b/src/input/decoder.c
index a881a06..847736c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -98,7 +98,7 @@ struct decoder_owner_sys_t
/* -- Theses variables need locking on read *and* write -- */
/* Preroll */
- int64_t i_preroll_end;
+ mtime_t i_preroll_end;
/* Pause */
mtime_t pause_date;
unsigned frames_countdown;
@@ -1550,7 +1550,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
vlc_object_release( p_dec );
return NULL;
}
- p_owner->i_preroll_end = INT64_MIN;
+ p_owner->i_preroll_end = VLC_TS_INVALID;
p_owner->i_last_rate = INPUT_RATE_DEFAULT;
p_owner->p_input = p_input;
p_owner->p_resource = p_resource;
diff --git a/src/input/es_out.c b/src/input/es_out.c
index bd01c3e..aebbe4d 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -296,7 +296,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
p_sys->i_rate = i_rate;
p_sys->b_buffering = true;
- p_sys->i_preroll_end = -1;
+ p_sys->i_preroll_end = VLC_TS_INVALID;
p_sys->i_prev_stream_level = -1;
return out;
@@ -596,7 +596,7 @@ static void EsOutChangePosition( es_out_t *out )
p_sys->i_buffering_extra_initial = 0;
p_sys->i_buffering_extra_stream = 0;
p_sys->i_buffering_extra_system = 0;
- p_sys->i_preroll_end = -1;
+ p_sys->i_preroll_end = VLC_TS_INVALID;
p_sys->i_prev_stream_level = -1;
}
@@ -616,7 +616,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
return;
mtime_t i_preroll_duration = 0;
- if( p_sys->i_preroll_end >= 0 )
+ if( p_sys->i_preroll_end > VLC_TS_INVALID )
i_preroll_duration = __MAX( p_sys->i_preroll_end - i_stream_start, 0 );
const mtime_t i_buffering_duration = p_sys->i_pts_delay +
@@ -646,7 +646,7 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
msg_Dbg( p_sys->p_input, "Stream buffering done (%d ms in %d ms)",
(int)(i_stream_duration/1000), (int)(i_system_duration/1000) );
p_sys->b_buffering = false;
- p_sys->i_preroll_end = -1;
+ p_sys->i_preroll_end = VLC_TS_INVALID;
p_sys->i_prev_stream_level = -1;
if( p_sys->i_buffering_extra_initial > 0 )
@@ -834,7 +834,7 @@ static void EsOutFrameNext( es_out_t *out )
( p_sys->i_buffering_extra_system - p_sys->i_buffering_extra_initial ) *
INPUT_RATE_DEFAULT / i_rate;
- p_sys->i_preroll_end = -1;
+ p_sys->i_preroll_end = VLC_TS_INVALID;
p_sys->i_prev_stream_level = -1;
}
static mtime_t EsOutGetBuffering( es_out_t *out )
@@ -2454,7 +2454,7 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
{
const int64_t i_date = (int64_t)va_arg( args, int64_t );
- if( i_date < 0 )
+ if( i_date <= VLC_TS_INVALID )
return VLC_EGENERIC;
p_sys->i_preroll_end = i_date;
--
2.8.2
More information about the vlc-devel
mailing list