[vlc-devel] [RFC-PATCH 03/12] core: mark blocks as part of preroll if they have a valid PTS

Filip Roséen filip at videolabs.io
Wed May 11 18:56:48 CEST 2016


The preroll should always be based on the PTS of a block_t, meaning that
we should only explicitly mark block_ts as part of the current preroll if:

    - we are currently prerolling, and;
    - the block has a valid PTS, and;
    - the PTS is lower then the current value of i_preroll_end.

If a block recieved does not have a valid PTS we should not implicitly
mark it as being part of the preroll; it is the senders job to make sure
that such blocks include BLOCK_FLAG_PREROLL in p_block->i_flags.

This might look like a breaking change, but it really should not be. The
relationship between the preroll, ES_OUT_SET_NEXT_DISPLAY_TIME, and the
decoded blocks are what should be used in cases where the incoming block
does not have a valid PTS.

We can also not base the decision on the DTS of an incoming entity,
since a DTS within the preroll does not necessary mean that the
(missing) PTS is also during the preroll.
---
 src/input/es_out.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/input/es_out.c b/src/input/es_out.c
index aebbe4d..6cfc112 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1955,14 +1955,12 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
     vlc_mutex_lock( &p_sys->lock );
 
     /* Mark preroll blocks */
-    if( p_sys->i_preroll_end >= 0 )
+    if( p_sys->i_preroll_end > VLC_TS_INVALID && p_block->i_pts > VLC_TS_INVALID )
     {
-        int64_t i_date = p_block->i_pts;
-        if( p_block->i_pts <= VLC_TS_INVALID )
-            i_date = p_block->i_dts;
-
-        if( i_date < p_sys->i_preroll_end )
+        if( p_block->i_pts < p_sys->i_preroll_end )
+        {
             p_block->i_flags |= BLOCK_FLAG_PREROLL;
+        }
     }
 
     if( !es->p_dec )
-- 
2.8.2



More information about the vlc-devel mailing list