[vlc-devel] [PATCH 2/2] decoder: remove vout polling from SPU decoders

Thomas Guillem thomas at gllm.fr
Tue Apr 2 17:19:08 CEST 2019


This fixes 2 issues:
 - A decoder/UI blockage of 6 seconds if there is no vouts when stopping a SPU
   es.
 - A possible delay of 200ms before getting the vout.
---
 src/input/decoder.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 36b5ac8f89..a5c635eaef 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -151,7 +151,6 @@ struct decoder_owner
 #define DECODER_BOGUS_VIDEO_DELAY                ((vlc_tick_t)(DEFAULT_PTS_DELAY * 30))
 
 /* */
-#define DECODER_SPU_VOUT_WAIT_DURATION   VLC_TICK_FROM_MS(200)
 #define BLOCK_FLAG_CORE_PRIVATE_RELOADED (1 << BLOCK_FLAG_CORE_PRIVATE_SHIFT)
 
 static inline struct decoder_owner *dec_get_owner( decoder_t *p_dec )
@@ -587,21 +586,8 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec,
                                      const subpicture_updater_t *p_updater )
 {
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
-    vout_thread_t *p_vout = NULL;
     subpicture_t *p_subpic;
-    int i_attempts = 30;
-
-    while( i_attempts-- )
-    {
-        if( p_owner->error )
-            break;
-
-        p_vout = input_resource_HoldVout( p_owner->p_resource );
-        if( p_vout )
-            break;
-
-        vlc_tick_sleep( DECODER_SPU_VOUT_WAIT_DURATION );
-    }
+    vout_thread_t *p_vout = input_resource_WaitVout( p_owner->p_resource, p_dec );
 
     if( !p_vout )
     {
@@ -2133,10 +2119,15 @@ void input_DecoderDelete( decoder_t *p_dec )
      * worker threads (if any) and the decoder thread to terminate. */
     if( p_dec->fmt_in.i_cat == VIDEO_ES && p_owner->p_vout != NULL )
         vout_Cancel( p_owner->p_vout, true );
+    if( p_dec->fmt_in.i_cat == SPU_ES )
+        input_resource_CancelWaitVout( p_owner->p_resource, p_dec );
     vlc_mutex_unlock( &p_owner->lock );
 
     vlc_join( p_owner->thread, NULL );
 
+    if( p_dec->fmt_in.i_cat == SPU_ES )
+        input_resource_CancelWaitVout( p_owner->p_resource, NULL );
+
     /* */
     if( p_owner->cc.b_supported )
     {
-- 
2.20.1



More information about the vlc-devel mailing list