[vlc-devel] [PATCH 05/13] resource: don't allow to terminate vouts

Thomas Guillem thomas at gllm.fr
Mon Apr 15 15:50:50 CEST 2019


Vouts must stopped by the instance that started them (video decoders).
---
 include/vlc_input.h          |  5 -----
 src/input/es_out.c           | 26 --------------------------
 src/input/input.c            |  1 -
 src/input/player.c           |  3 ---
 src/input/resource.c         | 12 +-----------
 src/input/vlm.c              |  1 -
 src/libvlccore.sym           |  1 -
 src/playlist_legacy/thread.c |  8 --------
 8 files changed, 1 insertion(+), 56 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index e6bd8440e3..72c72e3295 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -767,11 +767,6 @@ VLC_API input_resource_t * input_resource_New( vlc_object_t * ) VLC_USED;
  */
 VLC_API void input_resource_Release( input_resource_t * );
 
-/**
- * Forcefully destroys the video output (e.g. when the playlist is stopped).
- */
-VLC_API void input_resource_TerminateVout( input_resource_t * );
-
 /**
  * This function releases all resources (object).
  */
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 3352602849..072fb443e0 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -813,10 +813,6 @@ static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
     msg_Dbg( p_sys->p_input, "Decoder wait done in %d ms",
               (int)MS_FROM_VLC_TICK(vlc_tick_now() - i_decoder_buffering_start) );
 
-    /* Here is a good place to destroy unused vout with every demuxer */
-    input_resource_TerminateVout( input_priv(p_sys->p_input)->p_resource );
-
-
     /* */
     const vlc_tick_t i_wakeup_delay = VLC_TICK_FROM_MS(10); /* FIXME CLEANUP thread wake up time*/
     const vlc_tick_t i_current_date = p_sys->b_paused ? p_sys->i_pause_date : vlc_tick_now();
@@ -2494,24 +2490,6 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
                 i_mode == ES_OUT_MODE_AUTO || i_mode == ES_OUT_MODE_PARTIAL ||
                 i_mode == ES_OUT_MODE_END );
 
-        if (i_mode != ES_OUT_MODE_NONE && !p_sys->b_active && !vlc_list_is_empty(&p_sys->es))
-        {
-            /* XXX Terminate vout if there are tracks but no video one.
-             * This one is not mandatory but is he earliest place where it
-             * can be done */
-            es_out_id_t *p_es;
-            bool found = false;
-
-            foreach_es_then_es_slaves(p_es)
-                if( p_es->fmt.i_cat == VIDEO_ES && !found /* nested loop */ )
-                {
-                    found = true;
-                    break;
-                }
-
-            if (!found)
-                input_resource_TerminateVout( input_priv(p_sys->p_input)->p_resource );
-        }
         p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
         p_sys->i_mode = i_mode;
 
@@ -2931,10 +2909,6 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
         }
         int i_ret = EsOutControlLocked( out, i_new_query, p_es );
 
-        /* Clean up vout after user action (in active mode only).
-         * FIXME it does not work well with multiple video windows */
-        if( p_sys->b_active )
-            input_resource_TerminateVout( input_priv(p_sys->p_input)->p_resource );
         return i_ret;
     }
 
diff --git a/src/input/input.c b/src/input/input.c
index 506e269ecc..381b85a9fd 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2381,7 +2381,6 @@ static bool Control( input_thread_t *p_input,
                     ControlInsertDemuxFilter( p_input,
                                         vlc_renderer_item_demux_filter( p_item ) );
                 }
-                input_resource_TerminateVout( p_priv->p_resource );
             }
             es_out_Control( priv->p_es_out_display, ES_OUT_START_ALL_ES,
                             context );
diff --git a/src/input/player.c b/src/input/player.c
index f157f08959..316dc02a2b 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -882,10 +882,7 @@ vlc_player_destructor_Thread(void *data)
 
         if (inputs_changed)
         {
-            const bool started = player->started;
             vlc_player_Unlock(player);
-            if (!started)
-                input_resource_TerminateVout(player->resource);
             if (!keep_sout)
                 input_resource_TerminateSout(player->resource);
             vlc_player_Lock(player);
diff --git a/src/input/resource.c b/src/input/resource.c
index 322d6ed251..f977476f93 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -470,7 +470,7 @@ void input_resource_HoldVouts( input_resource_t *p_resource, vout_thread_t ***pp
     HoldVouts( p_resource, ppp_vout, pi_vout );
 }
 
-void input_resource_TerminateVout( input_resource_t *p_resource )
+static void input_resource_TerminateVout( input_resource_t *p_resource )
 {
     vlc_mutex_lock(&p_resource->lock);
     if (p_resource->p_vout_free != NULL)
@@ -482,16 +482,6 @@ void input_resource_TerminateVout( input_resource_t *p_resource )
     vlc_mutex_unlock(&p_resource->lock);
 }
 
-bool input_resource_HasVout( input_resource_t *p_resource )
-{
-    vlc_mutex_lock( &p_resource->lock );
-    assert( !p_resource->p_input );
-    const bool b_vout = p_resource->p_vout_free != NULL;
-    vlc_mutex_unlock( &p_resource->lock );
-
-    return b_vout;
-}
-
 /* */
 sout_instance_t *input_resource_RequestSout( input_resource_t *p_resource, sout_instance_t *p_sout, const char *psz_sout )
 {
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 93396ae3ac..761fa81da3 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -989,7 +989,6 @@ static int vlm_ControlMediaInstanceStart( vlm_t *p_vlm, int64_t id, const char *
 
         if( !p_instance->b_sout_keep )
             input_resource_TerminateSout( p_instance->p_input_resource );
-        input_resource_TerminateVout( p_instance->p_input_resource );
 
         vlm_SendEventMediaInstanceStopped( p_vlm, id, p_media->cfg.psz_name );
     }
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ed5e1ee661..0270f967f1 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -212,7 +212,6 @@ input_item_AddSlave
 input_Read
 input_resource_New
 input_resource_Release
-input_resource_TerminateVout
 input_resource_Terminate
 input_resource_GetAout
 input_resource_HoldAout
diff --git a/src/playlist_legacy/thread.c b/src/playlist_legacy/thread.c
index 26b06307c1..6d4cf9ee80 100644
--- a/src/playlist_legacy/thread.c
+++ b/src/playlist_legacy/thread.c
@@ -517,14 +517,6 @@ static void *Thread ( void *data )
             msg_Info( p_playlist, "end of playlist, exiting" );
             libvlc_Quit( vlc_object_instance(p_playlist) );
         }
-
-        /* Destroy any video display now (XXX: ugly hack) */
-        if( input_resource_HasVout( p_sys->p_input_resource ) )
-        {
-            PL_UNLOCK; /* Mind: NO LOCKS while manipulating input resources! */
-            input_resource_TerminateVout( p_sys->p_input_resource );
-            PL_LOCK;
-        }
     }
     PL_UNLOCK;
 
-- 
2.20.1



More information about the vlc-devel mailing list