Commit 647d418b authored by Laurent Aimar's avatar Laurent Aimar

Use audio desync as initial audio-delay value.

parent 46ff41d4
......@@ -290,9 +290,6 @@ struct aout_input_t
int i_last_input_rate;
/* internal caching delay from input */
int i_pts_delay;
/* desynchronisation delay request by the user */
int i_desync;
};
/** an output stream for the audio output */
......
......@@ -155,21 +155,18 @@ static aout_input_t * DecNew( vlc_object_t * p_this, aout_instance_t * p_aout,
aout_unlock_input_fifos( p_aout );
aout_unlock_mixer( p_aout );
p_input->i_desync = var_CreateGetInteger( p_this, "audio-desync" ) * 1000;
p_input_thread = (input_thread_t *)vlc_object_find( p_this,
VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input_thread )
{
p_input->i_pts_delay = p_input_thread->i_pts_delay;
p_input->i_pts_delay += p_input->i_desync;
p_input->p_input_thread = p_input_thread;
vlc_object_release( p_input_thread );
}
else
{
p_input->i_pts_delay = DEFAULT_PTS_DELAY;
p_input->i_pts_delay += p_input->i_desync;
p_input->p_input_thread = NULL;
}
......@@ -335,10 +332,6 @@ int aout_DecPlay( aout_instance_t * p_aout, aout_input_t * p_input,
return 0;
}
/* Apply the desynchronisation requested by the user */
p_buffer->start_date += p_input->i_desync;
p_buffer->end_date += p_input->i_desync;
if ( p_buffer->start_date > mdate() + p_input->i_pts_delay +
AOUT_MAX_ADVANCE_TIME )
{
......
......@@ -925,7 +925,8 @@ static void InitTitle( input_thread_t * p_input )
/* If the desynchronisation requested by the user is < 0, we need to
* cache more data. */
var_Get( p_input, "audio-desync", &val );
if( val.i_int < 0 ) p_input->i_pts_delay -= (val.i_int * 1000);
if( val.i_int < 0 )
p_input->i_pts_delay -= (val.i_int * 1000);
/* Update cr_average depending on the caching */
p_input->p->input.i_cr_average *= (10 * p_input->i_pts_delay / 200000);
......
......@@ -188,7 +188,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
/* Delay */
var_Create( p_input, "audio-delay", VLC_VAR_TIME );
val.i_time = 0;
val.i_time = INT64_C(1000) * var_GetInteger( p_input, "audio-desync" );
var_Change( p_input, "audio-delay", VLC_VAR_SETVALUE, &val, NULL );
var_Create( p_input, "spu-delay", VLC_VAR_TIME );
val.i_time = 0;
......@@ -770,15 +770,17 @@ static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
if( !strcmp( psz_cmd, "audio-delay" ) )
{
/*Change i_pts_delay to make sure es are decoded in time*/
if (newval.i_int < 0 || oldval.i_int < 0 )
/* Change i_pts_delay to make sure es are decoded in time */
if( newval.i_int < 0 || oldval.i_int < 0 )
{
p_input->i_pts_delay -= newval.i_int - oldval.i_int;
}
input_ControlPush( p_input, INPUT_CONTROL_SET_AUDIO_DELAY, &newval );
}
else if( !strcmp( psz_cmd, "spu-delay" ) )
{
input_ControlPush( p_input, INPUT_CONTROL_SET_SPU_DELAY, &newval );
}
return VLC_SUCCESS;
}
......
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