Commit 1d4d6cbc authored by Thomas Guillem's avatar Thomas Guillem

resource: don't allow to terminate vouts

Vouts must stopped by the instance that started them (video decoders).
parent b6c6aa8e
......@@ -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).
*/
......
......@@ -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 );
  • Eventually, we need to bring vout recycling back. And with this change, it becomes impossible, as there will be no way to know when the vout needs to be disabled rather than recycled.

  • Why would you want to disable a vout ? The main one should be kept alive no ? That is the purpose of this patch set.

    After this patch set, the vout is disabled when the player is destroyed, so at the very end?

  • Because the previous input item had more (active) video track(s). Typically audio file played after a audio/video file.

  • In that case, the vout will be stopped when the VIDEO decoder is destroyed. Stopped vout = Valid vout_thread_t with valid but disabled "vout window" plugin and no "vout display" plugin. When a "vout window" is disabled, the Video view/window must be gone too.

  • If you rely on that, then it's impossible to recycle the vout window.

  • I don't understand. The word "recycle" can be confusing here: do you mean destroyed and never used again or saved for a later use ?

    The purpose of this patch set is to never destroy the main vout. If you play more than one medias within the same VLC instance, the second media will use the vout used by the first media (and therefore the same window). For me, that is recycling.

    Edited by Thomas Guillem
  • Playing two consecutive videos without the video window exhibiting glitches. Like we have supported for years. I temporarily broke it, but that's not a reason to break it harder.

  • It is the job of "vout window" plugins to handle carefully consecutive enable()/disable() without glitches. I don't see why this issue is relevant with the current patch set.

    After many discussions (from the previous work shop), I though we were headed to always recycle the same "vout window" plugin.

  • it's not hard to guess that it's with GUI main loop.

    If that were possible, we would not have needed the TerminateVout calls in the first place.

  • Sorry but it is very hard to guess.

    I don't see how it can be different with a GUI.

    • vd->close + window->disable + window->destroy vs
    • vd->close + window->disable

    If the Qt window is doing something from the destroy callback to prevent glitches, It could be moved to the disable call.

  • Furthermore, I though that TerminateVout() was used to actually close the window by destroying the vout_thread_t.

    This is not needed anymore since you added window enable/disable() that is called when a video decoder is destroyed.

  • Eventually, we need to bring vout recycling back.

    Can you clarify what do you mean by vout recycling? vout_display recycling (meaning full vout_thread+vout_window+vout_display recycling) ? Or vout_window recycling for the same vout_thread ?

    At the vout workshop Nb.2, we discussed about keeping vout_thread just like we keep aout_thread, which is the scope of this patchset, and keeping vout_window so that we can give hardware hints to the decoders and easily configure it, following your work with the vout_window_ops. Is it still correct ?

    Playing two consecutive videos without the video window exhibiting glitches. Like we have supported for years. I temporarily broke it, but that's not a reason to break it harder.

    Do you mean not having the window transition to disable state between two inputs ? And, with the beginning of your review, that we won't be able to know if we need to recyle for example the second vout thread and not only the first ? If so, I think it has indeed been out of the scope of this patchset which only plans to recycle the first one. But why removing input_resource_TerminateVout prevents this ?

  • AH OK, this mean recycling vd + window plugin when playing 2 videos in a raw having the same size. I'll try to fix that then.

Please register or sign in to reply
/* */
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;
}
......
......@@ -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 );
......
......@@ -43,11 +43,4 @@ void input_item_SetEpgOffline( input_item_t * );
*/
void input_resource_TerminateSout( input_resource_t *p_resource );
/**
* This function return true if there is at least one vout in the resources.
*
* It can only be called on detached resources.
*/
bool input_resource_HasVout( input_resource_t *p_resource );
#endif
......@@ -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);
......
......@@ -467,7 +467,7 @@ exit:
vlc_mutex_unlock( &p_resource->lock );
}
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)
......@@ -479,16 +479,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 )
{
......
......@@ -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 );
}
......
......@@ -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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment