[vlc-devel] [PATCH 6/8] decoder: don't check picture/block date against preroll if there's no preroll

Steve Lhomme robux4 at ycbcr.xyz
Tue Aug 27 07:27:17 CEST 2019


---
 src/input/decoder.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index b419954bab..3b225dcc1f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -988,7 +988,6 @@ static bool DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_pictur
 {
     decoder_t *p_dec = &p_owner->dec;
     vout_thread_t  *p_vout = p_owner->p_vout;
-    bool prerolled;
 
     if( p_picture->date == VLC_TICK_INVALID )
     {
@@ -998,14 +997,14 @@ static bool DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_pictur
     }
 
     vlc_mutex_lock( &p_owner->lock );
-    if( p_owner->i_preroll_end > p_picture->date )
+    bool prerolled = p_owner->i_preroll_end != PREROLL_NONE;
+    if( prerolled && p_owner->i_preroll_end > p_picture->date )
     {
         vlc_mutex_unlock( &p_owner->lock );
         picture_Release( p_picture );
         return false;
     }
 
-    prerolled = p_owner->i_preroll_end != PREROLL_NONE;
     p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 
@@ -1133,7 +1132,6 @@ static void DecoderQueueThumbnail( decoder_t *p_dec, picture_t *p_pic )
 static bool DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio )
 {
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
-    bool prerolled;
 
     assert( p_audio != NULL );
 
@@ -1145,14 +1143,14 @@ static bool DecoderPlayAudio( decoder_t *p_dec, block_t *p_audio )
     }
 
     vlc_mutex_lock( &p_owner->lock );
-    if( p_owner->i_preroll_end > p_audio->i_pts )
+    bool prerolled = p_owner->i_preroll_end != PREROLL_NONE;
+    if( prerolled && p_owner->i_preroll_end > p_audio->i_pts )
     {
         vlc_mutex_unlock( &p_owner->lock );
         block_Release( p_audio );
         return false;
     }
 
-    prerolled = p_owner->i_preroll_end != PREROLL_NONE;
     p_owner->i_preroll_end = PREROLL_NONE;
     vlc_mutex_unlock( &p_owner->lock );
 
-- 
2.17.1



More information about the vlc-devel mailing list