[vlc-devel] [PATCH] input: decoder: fix end of preroll on discontinuity

Francois Cartegnie fcvlcdev at free.fr
Fri May 19 10:22:29 CEST 2017


End of preroll time was not updated properly.

Initial discontinuities were notified
through es_out/input_DecoderDiscontinuity
79cb45a41bdeaca63eb5fa2f3c53913ce463c6a5
using a forged empty block with discontinuity
flag.

Current decoders/demuxers discontinuity flag
is set on first block after discontinuity, and
is no longer empty data. We need to test for
this.

refs #18245
First spu dropped on preroll (preroll > INT_MIN)
(due to another special case/preroll incompatibility)
---
 src/input/decoder.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 400464d..06503b0 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -719,7 +719,13 @@ static int DecoderTimedWait( decoder_t *p_dec, mtime_t deadline )
 
 static inline void DecoderUpdatePreroll( int64_t *pi_preroll, const block_t *p )
 {
-    if( p->i_flags & (BLOCK_FLAG_PREROLL|BLOCK_FLAG_DISCONTINUITY) )
+    if( (p->i_flags & BLOCK_FLAG_DISCONTINUITY) &&
+        (p->i_buffer == 0 || (p->i_flags & BLOCK_FLAG_CORRUPTED)) )
+    {
+        /* We can't use this packet for end of preroll */
+        *pi_preroll = INT64_MAX;
+    }
+    else if( p->i_flags & BLOCK_FLAG_PREROLL )
         *pi_preroll = INT64_MAX;
     else if( p->i_dts > VLC_TS_INVALID )
         *pi_preroll = __MIN( *pi_preroll, p->i_dts );
-- 
2.9.4



More information about the vlc-devel mailing list