Browse Source

input: always call es_out functions from input thread

Locking the es_out can be blocking since it can wait for the decoder.
Therefore, we must always go through an input control to call es_out functions.

This is a partial revert of 1f51e1d214

When this partially reverted commit said:

"Maybe, it would be better to completely hide all input controls and let the
input implementation decide if a control need to be handled from the MainLoop
thread or can be handled directly."

=> This can only be done when all es_out control are non blocking (maybe with
the 5.0 input buffering rewrite ?)
pull/94/head
Thomas Guillem 7 years ago
parent
commit
5e2e94b644
  1. 28
      src/input/input.c
  2. 23
      src/input/input_internal.h
  3. 12
      src/input/player.c

28
src/input/input.c

@ -237,21 +237,6 @@ void input_SetPosition( input_thread_t *p_input, float f_position, bool b_fast )
input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &param );
}
void input_SetCategoryDelay(input_thread_t *input, enum es_format_category_e cat,
vlc_tick_t delay)
{
assert(cat == AUDIO_ES || cat == SPU_ES);
es_out_SetDelay(input_priv(input)->p_es_out_display, cat, delay);
}
void input_SetEsIdDelay(input_thread_t *input, vlc_es_id_t *es_id,
vlc_tick_t delay)
{
assert(es_id);
es_out_SetEsDelay(input_priv(input)->p_es_out_display,
vlc_es_id_get_out(es_id), delay);
}
/**
* Get the item from an input thread
* FIXME it does not increase ref count of the item.
@ -2090,6 +2075,19 @@ static bool Control( input_thread_t *p_input,
ViewpointApply( p_input );
break;
case INPUT_CONTROL_SET_CATEGORY_DELAY:
assert(param.cat_delay.cat == AUDIO_ES
|| param.cat_delay.cat == SPU_ES);
es_out_SetDelay(priv->p_es_out_display,
param.cat_delay.cat, param.cat_delay.delay);
break;
case INPUT_CONTROL_SET_ES_DELAY:
assert(param.es_delay.id);
es_out_SetEsDelay(priv->p_es_out_display,
vlc_es_id_get_out(param.es_delay.id),
param.es_delay.delay);
break;
case INPUT_CONTROL_SET_TITLE:
case INPUT_CONTROL_SET_TITLE_NEXT:
case INPUT_CONTROL_SET_TITLE_PREV:

23
src/input/input_internal.h

@ -323,16 +323,6 @@ void input_SetTime( input_thread_t *, vlc_tick_t i_time, bool b_fast );
void input_SetPosition( input_thread_t *, float f_position, bool b_fast );
/**
* Set the delay of an ES category
*
* If called before input_Start(), the delay will be applied for next ES
* tracks. If called after input_Start(), the delay will be applied for all
* tracks of the category (and all future tracks).
*/
void input_SetCategoryDelay(input_thread_t *input, enum es_format_category_e cat,
vlc_tick_t delay);
/**
* Set the delay of an ES identifier
*/
@ -407,6 +397,16 @@ typedef union
bool b_fast_seek;
float f_val;
} pos;
struct
{
enum es_format_category_e cat;
vlc_tick_t delay;
} cat_delay;
struct
{
vlc_es_id_t *id;
vlc_tick_t delay;
} es_delay;
struct {
vlc_es_id_t *id;
unsigned page;
@ -552,6 +552,9 @@ enum input_control_e
INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video)
INPUT_CONTROL_UPDATE_VIEWPOINT, // update viewpoint relative to current
INPUT_CONTROL_SET_CATEGORY_DELAY,
INPUT_CONTROL_SET_ES_DELAY,
INPUT_CONTROL_ADD_SLAVE,
INPUT_CONTROL_SET_SUBS_FPS,

12
src/input/player.c

@ -708,7 +708,11 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item)
input->cat_delays[i] = cat_delays[i];
if (cat_delays[i] != 0)
{
input_SetCategoryDelay(input->thread, i, cat_delays[i]);
const input_control_param_t param = {
.cat_delay = { i, cat_delays[i] }
};
input_ControlPush(input->thread, INPUT_CONTROL_SET_CATEGORY_DELAY,
&param);
vlc_player_SendEvent(player, on_category_delay_changed, i,
cat_delays[i]);
}
@ -3025,7 +3029,8 @@ vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat,
delay = *cat_delay;
}
input_SetCategoryDelay(input->thread, cat, delay);
const input_control_param_t param = { .cat_delay = { cat, delay } };
input_ControlPush(input->thread, INPUT_CONTROL_SET_CATEGORY_DELAY, &param);
vlc_player_vout_OSDMessage(player, _("%s delay: %i ms"),
es_format_category_to_string(cat),
(int)MS_FROM_VLC_TICK(delay));
@ -3071,7 +3076,8 @@ vlc_player_SetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id,
delay = trackpriv->delay;
}
input_SetEsIdDelay(input->thread, es_id, delay);
const input_control_param_t param = { .es_delay = { es_id, delay } };
input_ControlPush(input->thread, INPUT_CONTROL_SET_ES_DELAY, &param);
if (delay != INT64_MAX)
vlc_player_vout_OSDMessage(player, _("%s delay: %i ms"),
trackpriv->t.name,

Loading…
Cancel
Save